Merge pull request #5 from experimental-celestial-laboratories/hri7566/xcl-43-page-template-instead-of-copy-paste

Add root layout and remove per-page layout
This commit is contained in:
Hri7566 2023-09-14 01:07:11 -04:00 committed by GitHub
commit c04192d58a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 90 additions and 148 deletions

33
src/components/layout.tsx Normal file
View File

@ -0,0 +1,33 @@
import Head from "next/head";
export default function Layout({ children }: { children: React.ReactNode }) {
const bgs = [
"/bg/webp/bg1.webp",
"/bg/webp/bg2.webp",
"/bg/webp/bg3.webp",
"/bg/webp/bg4.webp",
"/bg/webp/bg5.webp",
"/bg/webp/bg6.webp",
"/bg/webp/bg7.webp",
"/bg/webp/bg8.webp",
"/bg/webp/bg9.webp",
];
const randomBg = bgs[Math.floor(Math.random() * bgs.length)] as string;
return (
<>
<Head>
<title>XCL</title>
<meta name="description" content="XCL homepage" />
<link rel="icon" href="/favicon.svg" />
</Head>
<main
className="bg-cover bg-center"
style={{ backgroundImage: `url("${randomBg}")` }}
>
{children}
</main>
</>
);
}

View File

@ -3,6 +3,7 @@ import { SessionProvider } from "next-auth/react";
import { type AppType } from "next/app";
import { api } from "~/utils/api";
import "~/styles/globals.css";
import Layout from "~/components/layout";
const MyApp: AppType<{ session: Session | null }> = ({
Component,
@ -10,7 +11,9 @@ const MyApp: AppType<{ session: Session | null }> = ({
}) => {
return (
<SessionProvider session={session}>
<Component {...pageProps} />
<Layout>
<Component {...pageProps} />
</Layout>
</SessionProvider>
);
};

View File

@ -1,63 +1,30 @@
import { signIn, signOut, useSession } from "next-auth/react";
import Head from "next/head";
import Image from "next/image";
import Link from "next/link";
import { api } from "~/utils/api";
import { Logo } from "../components/Logo";
import { LinkButton } from "../components/LinkButton";
import { NavigationBar } from "../components/NavigationBar";
import { PageContentBox } from "~/components/PageContentBox";
export default function About() {
const bgs = [
"/bg/webp/bg1.webp",
"/bg/webp/bg2.webp",
"/bg/webp/bg3.webp",
"/bg/webp/bg4.webp",
"/bg/webp/bg5.webp",
"/bg/webp/bg6.webp",
"/bg/webp/bg7.webp",
"/bg/webp/bg8.webp",
"/bg/webp/bg9.webp",
];
const randomBg = bgs[Math.floor(Math.random() * bgs.length)] as string;
return (
<>
<Head>
<title>XCL</title>
<meta name="description" content="About XCL" />
<link rel="icon" href="/favicon.ico" />
</Head>
{/* <main className="flex min-h-screen flex-col items-center justify-center bg-gradient-to-b from-[#993800] to-[#250e00]"> */}
<main
className="bg-cover bg-center"
style={{ backgroundImage: `url("${randomBg}")` }}
>
<div className="bg-black/60">
<div className="flex min-h-screen flex-col items-center justify-center bg-orange-800/40">
<Link className="absolute left-0 top-0" href="/">
<Logo />
</Link>
<div className="absolute right-0 top-0">
<NavigationBar />
</div>
<div className="container flex flex-col items-center justify-center gap-12 px-4 py-16">
<div className="grid grid-cols-1 gap-4 sm:grid-cols-1 md:gap-8">
<PageContentBox title="Our Mission">
Here at XCL, we strive to make the SwitchCraft 3 server as
unbearable as possible. While these noobs at SpaceTech are
feeding cookies to parrots, we build space stations not only
for the astronauts, but also for the olympians and war heroes
of our time.
</PageContentBox>
</div>
<div className="flex flex-col items-center gap-2"></div>
</div>
</div>
<div className="bg-black/60">
<div className="flex min-h-screen flex-col items-center justify-center bg-orange-800/40">
<Link className="absolute left-0 top-0" href="/">
<Logo />
</Link>
<div className="absolute right-0 top-0">
<NavigationBar />
</div>
</main>
</>
<div className="container flex flex-col items-center justify-center gap-12 px-4 py-16">
<div className="grid grid-cols-1 gap-4 sm:grid-cols-1 md:gap-8">
<PageContentBox title="Our Mission">
Here at XCL, we strive to make the SwitchCraft 3 server as
unbearable as possible. While these noobs at SpaceTech are feeding
cookies to parrots, we build space stations not only for the
astronauts, but also for the olympians and war heroes of our time.
</PageContentBox>
</div>
<div className="flex flex-col items-center gap-2"></div>
</div>
</div>
</div>
);
}

View File

@ -1,58 +1,26 @@
import { signIn, signOut, useSession } from "next-auth/react";
import Head from "next/head";
import Image from "next/image";
import Link from "next/link";
import { api } from "~/utils/api";
import { Logo } from "../components/Logo";
import { LinkButton } from "../components/LinkButton";
import { NavigationBar } from "../components/NavigationBar";
export default function Home() {
const bgs = [
"/bg/webp/bg1.webp",
"/bg/webp/bg2.webp",
"/bg/webp/bg3.webp",
"/bg/webp/bg4.webp",
"/bg/webp/bg5.webp",
"/bg/webp/bg6.webp",
"/bg/webp/bg7.webp",
"/bg/webp/bg8.webp",
"/bg/webp/bg9.webp",
];
const randomBg = bgs[Math.floor(Math.random() * bgs.length)] as string;
return (
<>
<Head>
<title>XCL</title>
<meta name="description" content="XCL homepage" />
<link rel="icon" href="/favicon.svg" />
</Head>
{/* <main className="flex min-h-screen flex-col items-center justify-center bg-gradient-to-b from-[#993800] to-[#250e00]"> */}
<main
className="bg-cover bg-center"
style={{ backgroundImage: `url("${randomBg}")` }}
>
<div className="bg-black/60">
<div className="flex min-h-screen flex-col items-center justify-center bg-orange-800/40">
<div className="absolute right-0 top-0">
<NavigationBar />
</div>
<div className="container flex flex-col items-center justify-center gap-12 px-4 py-16">
<Logo />
<div className="grid grid-cols-1 gap-4 sm:grid-cols-1 md:gap-8">
<LinkButton
href="https://git.hri7566.info/xcl"
title="Git →"
text="Learn more about XCL."
/>
</div>
<div className="flex flex-col items-center gap-2"></div>
</div>
</div>
<div className="bg-black/60">
<div className="flex min-h-screen flex-col items-center justify-center bg-orange-800/40">
<div className="absolute right-0 top-0">
<NavigationBar />
</div>
</main>
</>
<div className="container flex flex-col items-center justify-center gap-12 px-4 py-16">
<Logo />
<div className="grid grid-cols-1 gap-4 sm:grid-cols-1 md:gap-8">
<LinkButton
href="https://git.hri7566.info/xcl"
title="Git →"
text="Learn more about XCL."
/>
</div>
<div className="flex flex-col items-center gap-2"></div>
</div>
</div>
</div>
);
}

View File

@ -1,5 +1,3 @@
import { signIn, signOut, useSession } from "next-auth/react";
import Head from "next/head";
import Link from "next/link";
import { Logo } from "../components/Logo";
import { NavigationBar } from "~/components/NavigationBar";
@ -7,50 +5,23 @@ import { PageContentBox } from "~/components/PageContentBox";
import { EmployeeList } from "~/components/EmployeeList";
export default function Team() {
const bgs = [
"/bg/webp/bg1.webp",
"/bg/webp/bg2.webp",
"/bg/webp/bg3.webp",
"/bg/webp/bg4.webp",
"/bg/webp/bg5.webp",
"/bg/webp/bg6.webp",
"/bg/webp/bg7.webp",
"/bg/webp/bg8.webp",
"/bg/webp/bg9.webp",
];
const randomBg = bgs[Math.floor(Math.random() * bgs.length)] as string;
return (
<>
<Head>
<title>XCL</title>
<meta name="description" content="XCL's team" />
<link rel="icon" href="/favicon.ico" />
</Head>
{/* <main className="flex min-h-screen flex-col items-center justify-center bg-gradient-to-b from-[#993800] to-[#250e00]"> */}
<main
className="bg-cover bg-center"
style={{ backgroundImage: `url("${randomBg}")` }}
>
<div className="bg-black/60">
<div className="flex min-h-screen flex-col items-center justify-center bg-orange-800/40">
<Link className="absolute left-0 top-0" href="/">
<Logo />
</Link>
<div className="absolute right-0 top-0">
<NavigationBar />
</div>
<div className="container flex flex-col items-center justify-center gap-12 px-4 py-16">
<PageContentBox title="Employees">
<div className="grid grid-cols-1 md:grid-cols-3">
<EmployeeList />
</div>
</PageContentBox>
</div>
</div>
<div className="bg-black/60">
<div className="flex min-h-screen flex-col items-center justify-center bg-orange-800/40">
<Link className="absolute left-0 top-0" href="/">
<Logo />
</Link>
<div className="absolute right-0 top-0">
<NavigationBar />
</div>
</main>
</>
<div className="container flex flex-col items-center justify-center gap-12 px-4 py-16">
<PageContentBox title="Employees">
<div className="grid grid-cols-1 md:grid-cols-3">
<EmployeeList />
</div>
</PageContentBox>
</div>
</div>
</div>
);
}