Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

__root.tsx

82 lines2.0 KB

1import {
2 HeadContent,
3 Outlet,
4 Scripts,
5 createRootRoute,
6} from '@tanstack/react-router'
7import { TanStackRouterDevtoolsPanel } from '@tanstack/react-router-devtools'
8import { TanStackDevtools } from '@tanstack/react-devtools'
9​
10import { QueryClientProvider } from '@tanstack/react-query'
11import appCss from '../styles.css?url'
12import queryClient from '../queryClient'
13import HeroSection from '@/components/HeroSection'
14​
15export const Route = createRootRoute({
16 head: () => ({
17 meta: [
18 {
19 charSet: 'utf-8',
20 },
21 {
22 name: 'viewport',
23 content: 'width=device-width, initial-scale=1',
24 },
25 {
26 title: 'TanStack AI Search',
27 },
28 ],
29 links: [
30 {
31 rel: 'stylesheet',
32 href: appCss,
33 },
34 {
35 rel: 'icon',
36 type: 'image/svg+xml',
37 href: 'https://tanstack.com/favicon-light.svg',
38 media: '(prefers-color-scheme: light)',
39 },
40 {
41 rel: 'icon',
42 type: 'image/svg+xml',
43 href: 'https://tanstack.com/favicon-dark.svg',
44 media: '(prefers-color-scheme: dark)',
45 },
46 ],
47 }),
48​
49 shellComponent: RootDocument,
50​
51 notFoundComponent: () => <h1>Not Found</h1>,
52})
53​
54function RootDocument() {
55 return (
56 <html lang="en" className="dark">
57 <head>
58 <HeadContent />
59 </head>
60 <body className="bg-linear-to-b from-slate-900 via-slate-800 to-slate-900">
61 <div className="min-h-screen bg-linear-to-r from-cyan-500/10 via-blue-500/10 to-purple-500/10 flex flex-col">
62 <QueryClientProvider client={queryClient}>
63 <HeroSection />
64 <Outlet />
65 </QueryClientProvider>
66 </div>
67 <TanStackDevtools
68 config={{
69 position: 'bottom-right',
70 }}
71 plugins={[
72 {
73 name: 'TanStack Router Devtools Panel',
74 render: <TanStackRouterDevtoolsPanel />,
75 },
76 ]}
77 />
78 <Scripts />
79 </body>
80 </html>
81 )