| 1 | import { |
| 2 | createRootRoute, |
| 3 | HeadContent, |
| 4 | Outlet, |
| 5 | Scripts, |
| 6 | } from "@tanstack/react-router"; |
| 7 | import type { ReactNode } from "react"; |
| 8 | // Tailwind is wired through vite.config.ts (@tailwindcss/vite) — Alchemy |
| 9 | // runs the project's own `vite build`, so the utilities below compile. |
| 10 | import appCss from "../styles/global.css?url"; |
| 11 | |
| 12 | export const Route = createRootRoute({ |
| 13 | head: () => ({ |
| 14 | meta: [ |
| 15 | { charSet: "utf-8" }, |
| 16 | { name: "viewport", content: "width=device-width, initial-scale=1" }, |
| 17 | { title: "TanStack Start on Fly" }, |
| 18 | ], |
| 19 | links: [{ rel: "stylesheet", href: appCss }], |
| 20 | }), |
| 21 | component: RootComponent, |
| 22 | }); |
| 23 | |
| 24 | function RootComponent() { |
| 25 | return ( |
| 26 | <Document> |
| 27 | <Outlet /> |
| 28 | </Document> |
| 29 | ); |
| 30 | } |
| 31 | |
| 32 | function Document(props: Readonly<{ children: ReactNode }>) { |
| 33 | return ( |
| 34 | <html lang="en"> |
| 35 | <head> |
| 36 | <HeadContent /> |
| 37 | </head> |
| 38 | <body className="bg-slate-50 p-8 text-slate-900"> |
| 39 | {props.children} |
| 40 | <Scripts /> |
| 41 | </body> |
| 42 | </html> |
| 43 | ); |
| 44 | } |