mirror of
https://github.com/TheRealOwenRees/chess-scribe-website.git
synced 2026-07-23 09:56:57 +00:00
63 lines
1.9 KiB
TypeScript
63 lines
1.9 KiB
TypeScript
import { TanStackDevtools } from "@tanstack/react-devtools";
|
|
import { createRootRoute, HeadContent, Scripts } from "@tanstack/react-router";
|
|
import { TanStackRouterDevtoolsPanel } from "@tanstack/react-router-devtools";
|
|
import type { ReactNode } from "react";
|
|
import Footer from "../components/Footer";
|
|
import Header from "../components/Header";
|
|
|
|
import appCss from "../styles.css?url";
|
|
|
|
const THEME_INIT_SCRIPT = `(function(){try{var stored=window.localStorage.getItem('theme');var mode=(stored==='light'||stored==='dark'||stored==='auto')?stored:'auto';var prefersDark=window.matchMedia('(prefers-color-scheme: dark)').matches;var resolved=mode==='auto'?(prefersDark?'dark':'light'):mode;var root=document.documentElement;root.classList.remove('light','dark');root.classList.add(resolved);if(mode==='auto'){root.removeAttribute('data-theme')}else{root.setAttribute('data-theme',mode)}root.style.colorScheme=resolved;}catch(e){}})();`;
|
|
|
|
export const Route = createRootRoute({
|
|
head: () => ({
|
|
meta: [
|
|
{
|
|
charSet: "utf-8",
|
|
},
|
|
{
|
|
name: "viewport",
|
|
content: "width=device-width, initial-scale=1",
|
|
},
|
|
{
|
|
title: "TanStack Start Starter",
|
|
},
|
|
],
|
|
links: [
|
|
{
|
|
rel: "stylesheet",
|
|
href: appCss,
|
|
},
|
|
],
|
|
}),
|
|
shellComponent: RootDocument,
|
|
});
|
|
|
|
function RootDocument({ children }: { children: ReactNode }) {
|
|
return (
|
|
<html lang="en" suppressHydrationWarning>
|
|
<head>
|
|
<script dangerouslySetInnerHTML={{ __html: THEME_INIT_SCRIPT }} />
|
|
<HeadContent />
|
|
</head>
|
|
<body className="font-sans antialiased [overflow-wrap:anywhere] selection:bg-[rgba(79,184,178,0.24)]">
|
|
<Header />
|
|
{children}
|
|
<Footer />
|
|
<TanStackDevtools
|
|
config={{
|
|
position: "bottom-right",
|
|
}}
|
|
plugins={[
|
|
{
|
|
name: "Tanstack Router",
|
|
render: <TanStackRouterDevtoolsPanel />,
|
|
},
|
|
]}
|
|
/>
|
|
<Scripts />
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|