Abstract header/footer & document body into Page component

This commit is contained in:
Xevion
2022-12-18 00:24:24 -06:00
parent a7532733f1
commit 33d0098562
2 changed files with 71 additions and 52 deletions

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

@@ -0,0 +1,33 @@
import Link from "next/link";
import type {FunctionComponent} from "react";
import React from "react";
interface PageProps {
children: React.ReactNode;
}
const Page: FunctionComponent<PageProps> = ({children}: PageProps) => {
return (
<>
<main className="flex w-full flex-col items-center bg-white">
<div className="mt-8 px-3 max-w-screen-md w-[90%]">
<h1 className="text-3xl font-rokkitt text-zinc-800 sm:text-5xl mb-2">100Prisoners.com</h1>
{children}
<div className="flex flex-col items-center">
<div className="grid py-1 grid-cols-1 gap-x-1 whitespace-nowrap divide-x-2">
<div className="col-span-1 p-2">
Created by <Link href={"https://xevion.dev"} about="_blank">
<span className="font-bold">
Ryan Walters
</span>
</Link>
</div>
</div>
</div>
</div>
</main>
</>
);
};
export default Page;

View File

@@ -2,7 +2,7 @@ import {type NextPage} from "next";
import Head from "next/head";
import BoxTable from "@/components/BoxTable";
import NoSSR from "react-no-ssr";
import Link from "next/link";
import Page from "@/components/Page";
const Home: NextPage = () => {
return (
@@ -11,9 +11,7 @@ const Home: NextPage = () => {
<title>100prisoners.com</title>
<link rel="icon" href="/favicon.ico"/>
</Head>
<main className="flex w-full flex-col items-center bg-white">
<div className="mt-8 px-3 max-w-screen-md w-[90%]">
<h1 className="text-3xl font-rokkitt text-zinc-800 sm:text-5xl mb-2">100Prisoners.com</h1>
<Page>
<div className="prose lg:prose-xl">
<p>
This website is dedicated to exploring the intriguing 100 prisoners problem, a mathematical
@@ -50,19 +48,7 @@ const Home: NextPage = () => {
<BoxTable/>
</NoSSR>
</div>
<div className="flex flex-col items-center">
<div className="grid py-1 grid-cols-1 gap-x-1 whitespace-nowrap divide-x-2">
<div className="col-span-1 p-2">
Created by <Link href={"https://xevion.dev"} about="_blank">
<span className="font-bold">
Ryan Walters
</span>
</Link>
</div>
</div>
</div>
</div>
</main>
</Page>
</>
);
};