| 1 | import type { ReactNode } from "react"; |
| 2 | import { |
| 3 | HeadContent, |
| 4 | Outlet, |
| 5 | Scripts, |
| 6 | createRootRoute, |
| 7 | } from "@tanstack/react-router"; |
| 8 | import appCss from "../styles.css?url"; |
| 9 | |
| 10 | export const Route = createRootRoute({ |
| 11 | head: () => ({ |
| 12 | meta: [ |
| 13 | { |
| 14 | charSet: "utf-8", |
| 15 | }, |
| 16 | { |
| 17 | name: "viewport", |
| 18 | content: "width=device-width, initial-scale=1", |
| 19 | }, |
| 20 | { |
| 21 | title: "TanStack Start on Cloudflare", |
| 22 | }, |
| 23 | ], |
| 24 | links: [ |
| 25 | { |
| 26 | rel: "stylesheet", |
| 27 | href: appCss, |
| 28 | }, |
| 29 | ], |
| 30 | }), |
| 31 | component: RootComponent, |
| 32 | }); |
| 33 | |
| 34 | function RootComponent() { |
| 35 | return ( |
| 36 | <Document> |
| 37 | <Outlet /> |
| 38 | </Document> |
| 39 | ); |
| 40 | } |
| 41 | |
| 42 | function Document(props: Readonly<{ children: ReactNode }>) { |
| 43 | return ( |
| 44 | <html lang="en"> |
| 45 | <head> |
| 46 | <HeadContent /> |
| 47 | </head> |
| 48 | <body className="bg-slate-50 p-8 text-slate-900"> |
| 49 | {props.children} |
| 50 | <Scripts /> |
| 51 | </body> |
| 52 | </html> |
| 53 | ); |
| 54 | } |