Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions apps/web/src/app/[locale]/(main)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import "@tietokilta/ui/global.css";
import "../globals.css";
import { getScopedI18n, type Locale } from "@locales/server";
import { DigiCommitteeRecruitmentAlert } from "@components/digi-committee-recruitment-alert";
// import "./globals.css";
import { fetchMainNavigation } from "@lib/api/main-navigation";
import "./system-seven/system-seven.css";
import "./system-seven/glitch.css";

Expand Down Expand Up @@ -77,9 +77,19 @@ export default async function RootLayout(

const { children } = props;

const mainNav = await fetchMainNavigation(locale)({});
const systemSeven = mainNav?.enableSystemSevenTheme ?? false;

return (
<html lang={locale}>
<body className={cn(inter.variable, robotoMono.variable, "font-sans")}>
<body
className={cn(
inter.variable,
robotoMono.variable,
"font-sans",
systemSeven && "system-seven-theme",
)}
>
<SkipLink />
<DigiCommitteeRecruitmentAlert />
<NextTopLoader color="var(--color-gray-100)" showSpinner={false} />
Expand Down
19 changes: 16 additions & 3 deletions apps/web/src/app/[locale]/(main)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import { fetchLandingPage } from "@lib/api/landing-page";
import { AnnouncementCard } from "@components/announcement-card";
import { getCurrentLocale } from "@locales/server";
import AprilFoolsAlert from "@components/april-fools/april-fools-alert";
import { type NonNullableKeys } from "@lib/utils";
import { type NonNullableKeys, cn } from "@lib/utils";
import { fetchMainNavigation } from "@lib/api/main-navigation";

function Content({ content }: { content?: EditorState }) {
if (!content) return null;
Expand Down Expand Up @@ -39,6 +40,9 @@ export default async function Home(props: {
throw new Error("Unable to fetch landing page data");
}

const mainNav = await fetchMainNavigation(locale)({});
const systemSeven = mainNav?.enableSystemSevenTheme ?? false;

const body = landingPageData.body as unknown as EditorState | undefined;
const announcement = landingPageData.announcement as News | undefined;
const eventsListPage = landingPageData.eventsListPage as CMSPage | undefined;
Expand All @@ -60,12 +64,16 @@ export default async function Home(props: {
texts={landingPageData.heroTexts
.map(({ text }) => (typeof text === "string" ? text : null))
.filter((url): url is string => Boolean(url))}
systemSeven={systemSeven}
/>
{/* Desktop view */}
<div className="container mx-auto hidden grid-cols-2 gap-12 px-6 py-12 lg:grid">
<section className="order-first space-y-4">
<h1
className="glitch layers font-mono text-4xl font-bold text-gray-900"
className={cn(
"font-mono text-4xl font-bold text-gray-900",
systemSeven && "glitch layers",
)}
data-text="Tietokilta"
>
Tietokilta
Expand All @@ -77,6 +85,7 @@ export default async function Home(props: {
<EventsDisplay
eventsListPath={eventsListPage?.path ?? undefined}
currentPage={!isNaN(pageInt) ? pageInt : undefined}
systemSeven={systemSeven}
/>
</div>
</div>
Expand All @@ -87,7 +96,10 @@ export default async function Home(props: {
</div>
<section className="space-y-4">
<h1
className="glitch layers font-mono text-4xl font-bold text-gray-900"
className={cn(
"font-mono text-4xl font-bold text-gray-900",
systemSeven && "glitch layers",
)}
data-text="Tietokilta"
>
Tietokilta
Expand All @@ -97,6 +109,7 @@ export default async function Home(props: {
<EventsDisplay
eventsListPath={eventsListPage?.path ?? undefined}
currentPage={!isNaN(pageInt) ? pageInt : undefined}
systemSeven={systemSeven}
/>
</div>
<AprilFoolsAlert />
Expand Down
226 changes: 114 additions & 112 deletions apps/web/src/app/[locale]/(main)/system-seven/glitch.css
Original file line number Diff line number Diff line change
@@ -1,84 +1,3 @@
.layers {
position: relative;
}

.layers::before,
.layers::after {
content: attr(data-text);
position: absolute;
width: 110%;
z-index: -1;
}

.layers::before {
top: 10px;
left: 15px;
color: #b31b1b;
}

.layers::after {
top: 5px;
left: -10px;
color: #191ebd;
}

.single-path {
clip-path: polygon(
0% 12%,
53% 12%,
53% 26%,
25% 26%,
25% 86%,
31% 86%,
31% 0%,
53% 0%,
53% 84%,
92% 84%,
92% 82%,
70% 82%,
70% 29%,
78% 29%,
78% 65%,
69% 65%,
69% 66%,
77% 66%,
77% 45%,
85% 45%,
85% 26%,
97% 26%,
97% 28%,
84% 28%,
84% 34%,
54% 34%,
54% 89%,
30% 89%,
30% 58%,
83% 58%,
83% 5%,
68% 5%,
68% 36%,
62% 36%,
62% 1%,
12% 1%,
12% 34%,
60% 34%,
60% 57%,
98% 57%,
98% 83%,
1% 83%,
1% 53%,
91% 53%,
91% 84%,
8% 84%,
8% 83%,
4% 83%
);
}

.paths {
animation: paths 5s step-end infinite;
}

@keyframes paths {
0% {
clip-path: polygon(
Expand Down Expand Up @@ -331,12 +250,6 @@
}
}

.movement {
/* Normally this position would be absolute & on the layers, set to relative here so we can see it on the div */
position: relative;
animation: movement 8s step-end infinite;
}

@keyframes movement {
0% {
top: 0px;
Expand Down Expand Up @@ -364,10 +277,6 @@
}
}

.opacity {
animation: opacity 5s step-end infinite;
}

@keyframes opacity {
0% {
opacity: 0.1;
Expand Down Expand Up @@ -403,10 +312,6 @@
}
}

.font {
animation: font 7s step-end infinite;
}

@keyframes font {
0% {
font-weight: 100;
Expand Down Expand Up @@ -439,22 +344,119 @@
}
}

.glitch span {
animation: paths 5s step-end infinite;
}
.system-seven-theme {
.layers {
position: relative;
}

.glitch::before {
animation:
paths 5s step-end infinite,
opacity 5s step-end infinite,
font 8s step-end infinite,
movement 10s step-end infinite;
}
.layers::before,
.layers::after {
content: attr(data-text);
position: absolute;
width: 110%;
z-index: -1;
}

.glitch::after {
animation:
paths 5s step-end infinite,
opacity 5s step-end infinite,
font 7s step-end infinite,
movement 8s step-end infinite;
}
.layers::before {
top: 10px;
left: 15px;
color: #b31b1b;
}

.layers::after {
top: 5px;
left: -10px;
color: #191ebd;
}

.single-path {
clip-path: polygon(
0% 12%,
53% 12%,
53% 26%,
25% 26%,
25% 86%,
31% 86%,
31% 0%,
53% 0%,
53% 84%,
92% 84%,
92% 82%,
70% 82%,
70% 29%,
78% 29%,
78% 65%,
69% 65%,
69% 66%,
77% 66%,
77% 45%,
85% 45%,
85% 26%,
97% 26%,
97% 28%,
84% 28%,
84% 34%,
54% 34%,
54% 89%,
30% 89%,
30% 58%,
83% 58%,
83% 5%,
68% 5%,
68% 36%,
62% 36%,
62% 1%,
12% 1%,
12% 34%,
60% 34%,
60% 57%,
98% 57%,
98% 83%,
1% 83%,
1% 53%,
91% 53%,
91% 84%,
8% 84%,
8% 83%,
4% 83%
);
}

.paths {
animation: paths 5s step-end infinite;
}

.movement {
/* Normally this position would be absolute & on the layers, set to relative here so we can see it on the div */
position: relative;
animation: movement 8s step-end infinite;
}

.opacity {
animation: opacity 5s step-end infinite;
}

.font {
animation: font 7s step-end infinite;
}

.glitch span {
animation: paths 5s step-end infinite;
}

.glitch::before {
animation:
paths 5s step-end infinite,
opacity 5s step-end infinite,
font 8s step-end infinite,
movement 10s step-end infinite;
}

.glitch::after {
animation:
paths 5s step-end infinite,
opacity 5s step-end infinite,
font 7s step-end infinite,
movement 8s step-end infinite;
}
}
Loading
Loading