Open History to see the last commit
1/// <reference types="vite/client" />
2import {
3 HeadContent,
4 Link,
5 Scripts,
6 createRootRoute,
7} from '@tanstack/solid-router'
8import { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'
9import { HydrationScript } from 'solid-js/web'
10import type * as Solid from 'solid-js'
11import { DefaultCatchBoundary } from '~/components/DefaultCatchBoundary'
12import { NotFound } from '~/components/NotFound'
13import appCss from '~/styles/app.css?url'
14import { seo } from '~/utils/seo'
15β
16export const Route = createRootRoute({
17 head: () => ({
18 meta: [
19 {
20 charset: 'utf-8',
21 },
22 {
23 name: 'viewport',
24 content: 'width=device-width, initial-scale=1',
25 },
26 ...seo({
27 title:
28 'TanStack Start | Type-Safe, Client-First, Full-Stack React Framework',
29 description: `TanStack Start is a type-safe, client-first, full-stack React framework. `,
30 }),
31 ],
32 links: [
33 { rel: 'stylesheet', href: appCss },
34 {
35 rel: 'apple-touch-icon',
36 sizes: '180x180',
37 href: '/apple-touch-icon.png',
38 },
39 {
40 rel: 'icon',
41 type: 'image/png',
42 sizes: '32x32',
43 href: '/favicon-32x32.png',
44 },
45 {
46 rel: 'icon',
47 type: 'image/png',
48 sizes: '16x16',
49 href: '/favicon-16x16.png',
50 },
51 { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },
52 { rel: 'icon', href: '/favicon.ico' },
53 ],
54 scripts: [
55 {
56 src: '/customScript.js',
57 type: 'text/javascript',
58 },
59 ],
60 }),
61 errorComponent: DefaultCatchBoundary,
62 notFoundComponent: () => <NotFound />,
63 shellComponent: RootDocument,
64})
65β
66function RootDocument({ children }: { children: Solid.JSX.Element }) {
67 return (
68 <html>
69 <head>
70 <HydrationScript />
71 </head>
72 <body>
73 <HeadContent />
74 <div class="p-2 flex gap-2 text-lg">
75 <Link
76 to="/"
77 activeProps={{
78 class: 'font-bold',
79 }}
80 activeOptions={{ exact: true }}
81 >
82 Home
83 </Link>{' '}
84 <Link
85 to="/posts"
86 activeProps={{
87 class: 'font-bold',
88 }}
89 >
90 Posts
91 </Link>{' '}
92 <Link
93 to="/users"
94 activeProps={{
95 class: 'font-bold',
96 }}
97 >
98 Users
99 </Link>{' '}
100 <Link
101 to="/route-a"
102 activeProps={{
103 class: 'font-bold',
104 }}
105 >
106 Pathless Layout
107 </Link>{' '}
108 <Link
109 to="/deferred"
110 activeProps={{
111 class: 'font-bold',
112 }}
113 >
114 Deferred
115 </Link>{' '}
116 <Link
117 // @ts-expect-error
118 to="/this-route-does-not-exist"
119 activeProps={{
120 class: 'font-bold',
121 }}
122 >
123 This Route Does Not Exist
124 </Link>
125 </div>
126 <hr />
127 {children}
128 <TanStackRouterDevtools position="bottom-right" />
129 <Scripts />
130 </body>
131 </html>
132 )
133}