Skip to content

Commit 837a219

Browse files
committed
alright
1 parent f11a7ad commit 837a219

4 files changed

Lines changed: 51 additions & 40 deletions

File tree

src/app/games/client.tsx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
"use client";
2+
3+
import GamesButton from "@/components/GamesButton";
4+
import { useSearchParams } from "next/navigation";
5+
6+
export default function GamesClient() {
7+
const params = useSearchParams();
8+
const game = params.get("g");
9+
if (game) {
10+
return (
11+
<iframe className={"h-dvh w-dvw"} src={`/${game}/index.html`}></iframe>
12+
);
13+
} else {
14+
return (
15+
<div className="flex flex-col items-center gap-5">
16+
<h1 className="justify-center text-7xl w-fit text-primary overflow-hidden">
17+
Games
18+
</h1>
19+
<h2 className="justify-center text-3xl w-fit text-secondary overflow-hidden">
20+
Some (very unfinished) games by yours truly!
21+
</h2>
22+
<nav className=" grid grid-cols-3 gap-10">
23+
<GamesButton to="br2" name="Banana Run 2"></GamesButton>
24+
<GamesButton to="br3" name="Banana Run 3"></GamesButton>
25+
<GamesButton
26+
to="cfp"
27+
name="Click For Points (web edition)"
28+
></GamesButton>
29+
<GamesButton
30+
to="clicks_and_points"
31+
name="Clicks & Points (VERY VERY EARLY DEVELOPEMENT)"
32+
></GamesButton>
33+
<GamesButton to="plat" name="Unnamed platformer game"></GamesButton>
34+
</nav>
35+
</div>
36+
);
37+
}
38+
}

src/app/games/page.tsx

Lines changed: 10 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,10 @@
1-
"use client";
2-
3-
import GamesButton from "@/components/GamesButton";
4-
import { useSearchParams } from "next/navigation";
5-
6-
export default function GamesClient() {
7-
const params = useSearchParams();
8-
const game = params.get("g");
9-
if (game) {
10-
return (
11-
<iframe className={"h-dvh w-dvw"} src={`/${game}/index.html`}></iframe>
12-
);
13-
} else {
14-
return (
15-
<div className="flex flex-col items-center gap-5">
16-
<h1 className="justify-center text-7xl w-fit text-primary overflow-hidden">
17-
Games
18-
</h1>
19-
<h2 className="justify-center text-3xl w-fit text-secondary overflow-hidden">
20-
Some (very unfinished) games by yours truly!
21-
</h2>
22-
<nav className=" grid grid-cols-3 gap-10">
23-
<GamesButton to="br2" name="Banana Run 2"></GamesButton>
24-
<GamesButton to="br3" name="Banana Run 3"></GamesButton>
25-
<GamesButton
26-
to="cfp"
27-
name="Click For Points (web edition)"
28-
></GamesButton>
29-
<GamesButton
30-
to="clicks_and_points"
31-
name="Clicks & Points (VERY VERY EARLY DEVELOPEMENT)"
32-
></GamesButton>
33-
<GamesButton to="plat" name="Unnamed platformer game"></GamesButton>
34-
</nav>
35-
</div>
36-
);
37-
}
38-
}
1+
import { Suspense } from "react";
2+
import GamesClient from "./client";
3+
4+
export default function Games() {
5+
return (
6+
<Suspense fallback={<p>Loading...</p>}>
7+
<GamesClient />
8+
</Suspense>
9+
);
10+
}

src/app/layout.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export default function RootLayout({
2525
</header>
2626

2727
<SetColor />
28+
2829
<main className="grow content-center">{children}</main>
2930
</body>
3031
</html>

src/components/SetColor.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use client";
22

3-
import { useEffect } from "react";
3+
import { useLayoutEffect } from "react";
44

55
export default function SetColor() {
66
// Stackoverflow, you may be pretty much dead, but you aren't dead in my heart!
@@ -14,7 +14,7 @@ export default function SetColor() {
1414
return color;
1515
}
1616

17-
useEffect(() => {
17+
useLayoutEffect(() => {
1818
document.documentElement.style.setProperty("--secondary", getRandomColor());
1919
}, []);
2020

0 commit comments

Comments
 (0)