Skip to content

Commit 9f406d0

Browse files
committed
re-Give metadata to background, fix stupid system that i made because of an old error, and set color thing in seperate function
1 parent cb279d7 commit 9f406d0

4 files changed

Lines changed: 66 additions & 70 deletions

File tree

src/app/games/GamesClient.tsx

Lines changed: 0 additions & 38 deletions
This file was deleted.

src/app/games/page.tsx

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,38 @@
1-
import { Suspense } from "react";
2-
import GamesClient from "./GamesClient";
1+
"use client";
32

4-
export default function Games() {
5-
return (
6-
<Suspense fallback={<></>}>
7-
<GamesClient />
8-
</Suspense>
9-
);
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+
}
1038
}

src/app/layout.tsx

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,21 @@
1-
"use client";
1+
import SetColor from "@/components/SetColor";
22
import SwitcherLink from "@/components/SwitcherLink";
3-
import { useEffect, useRef } from "react";
3+
import { Metadata } from "next";
44
import "./globals.css";
55

6-
// export const metadata: Metadata = {
7-
// title: "Precontation",
8-
// description: "Epic generic website! (wow)",
9-
// };
6+
export const metadata: Metadata = {
7+
title: "Precontation",
8+
description: "Epic generic website! (wow)",
9+
};
1010

1111
export default function RootLayout({
1212
children,
1313
}: Readonly<{
1414
children: React.ReactNode;
1515
}>) {
16-
// Stackoverflow, you may be pretty much dead, but you aren't dead in my heart!
17-
// Modified from https://stackoverflow.com/questions/1484506/random-color-generator
18-
function getRandomColor() {
19-
const letters = "89ABCDEF89ABCDEF";
20-
let color = "#";
21-
for (let i = 0; i < 6; i++) {
22-
color += letters[Math.floor(Math.random() * 16)];
23-
}
24-
return color;
25-
}
26-
27-
const rootRef = useRef<HTMLHtmlElement>(null);
28-
29-
useEffect(() => {
30-
rootRef.current?.style.setProperty("--secondary", getRandomColor());
31-
}, []);
32-
3316
return (
34-
<html lang="en" ref={rootRef}>
17+
<html lang="en">
18+
<SetColor />
3519
<body className="antialiased flex flex-col min-h-screen">
3620
<header className="backdrop-blur-3xl border-b sticky top-0 min-w-full z-100">
3721
<nav className="flex gap-10 h-10 justify-center">

src/components/SetColor.tsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
"use client";
2+
3+
import { useEffect } from "react";
4+
5+
export default function SetColor() {
6+
// Stackoverflow, you may be pretty much dead, but you aren't dead in my heart!
7+
// Modified from https://stackoverflow.com/questions/1484506/random-color-generator
8+
function getRandomColor() {
9+
const letters = "89ABCDEF89ABCDEF";
10+
let color = "#";
11+
for (let i = 0; i < 6; i++) {
12+
color += letters[Math.floor(Math.random() * 16)];
13+
}
14+
return color;
15+
}
16+
17+
useEffect(() => {
18+
document.documentElement.style.setProperty("--secondary", getRandomColor());
19+
}, []);
20+
21+
return <></>;
22+
}

0 commit comments

Comments
 (0)