DrMint 35b58982d0
Use Jotai instead of React Context (#65)
* Turn React Context into Jotai

* Finish converting the remaining contexts into Jotai

* Changed the readme

* Fixed build

* Provider hell be gone

* Fixed build
2022-11-04 02:30:20 +01:00

55 lines
2.1 KiB
TypeScript

import { GetStaticProps } from "next";
import { AppLayout, AppLayoutRequired } from "components/AppLayout";
import { ReturnButton } from "components/PanelComponents/ReturnButton";
import { ContentPanel } from "components/Containers/ContentPanel";
import { getOpenGraph } from "helpers/openGraph";
import { getLangui } from "graphql/fetchLocalData";
import { Img } from "components/Img";
import { atoms } from "contexts/atoms";
import { useAtomGetter } from "helpers/atoms";
/*
* ╭────────╮
* ──────────────────────────────────────────╯ PAGE ╰─────────────────────────────────────────────
*/
interface Props extends AppLayoutRequired {}
const FourOhFour = ({ openGraph, ...otherProps }: Props): JSX.Element => {
const langui = useAtomGetter(atoms.localData.langui);
return (
<AppLayout
contentPanel={
<ContentPanel>
<Img
src={"/gameover_cards.webp"}
className="animate-zoom-in drop-shadow-lg shadow-shade"
/>
<div className="mt-8 grid place-items-center gap-6">
<h2>{langui.page_not_found}</h2>
<ReturnButton href="/" title="Home" />
</div>
</ContentPanel>
}
openGraph={openGraph}
{...otherProps}
/>
);
};
export default FourOhFour;
/*
* ╭──────────────────────╮
* ───────────────────────────────────╯ NEXT DATA FETCHING ╰──────────────────────────────────────
*/
export const getStaticProps: GetStaticProps = (context) => {
const langui = getLangui(context.locale);
const props: Props = {
openGraph: getOpenGraph(langui, `404 - ${langui.page_not_found}`),
};
return {
props: props,
};
};