Open History to see the last commit
1/// <reference types="vite/client" />
2import {
3 HeadContent,
4 Link,
5 Outlet,
6 Scripts,
7 createRootRoute,
8} from '@tanstack/solid-router'
9β
10import { TanStackRouterDevtoolsInProd } from '@tanstack/solid-router-devtools'
11import { HydrationScript } from 'solid-js/web'
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 name: 'viewport',
21 content: 'width=device-width, initial-scale=1',
22 },
23 ...seo({
24 title:
25 'TanStack Start | Type-Safe, Client-First, Full-Stack React Framework',
26 description: `TanStack Start is a type-safe, client-first, full-stack React framework. `,
27 }),
28 ],
29 links: [
30 { rel: 'stylesheet', href: appCss },
31 {
32 rel: 'apple-touch-icon',
33 sizes: '180x180',
34 href: '/apple-touch-icon.png',
35 },
36 {
37 rel: 'icon',
38 type: 'image/png',
39 sizes: '32x32',
40 href: '/favicon-32x32.png',
41 },
42 {
43 rel: 'icon',
44 type: 'image/png',
45 sizes: '16x16',
46 href: '/favicon-16x16.png',
47 },
48 { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },
49 { rel: 'icon', href: '/favicon.ico' },
50 ],
51 styles: [
52 {
53 media: 'all and (min-width: 500px)',
54 children: `
55 .inline-div {
56 color: white;
57 background-color: gray;
58 max-width: 250px;
59 }`,
60 },
61 ],
62 }),
63 errorComponent: (props) => <p>{props.error.stack}</p>,
64 notFoundComponent: () => <NotFound />,
65 component: RootComponent,
66})
67β
68function RootComponent() {
69 return (
70 <html>
71 <head>
72 <HydrationScript />
73 </head>
74 <body>
75 <HeadContent />
76 <div class="p-2 flex gap-2 text-lg">
77 <Link
78 to="/"
79 activeProps={{
80 class: 'font-bold',
81 }}
82 activeOptions={{ exact: true }}
83 >
84 Home
85 </Link>{' '}
86 <Link
87 to="/posts"
88 activeProps={{
89 class: 'font-bold',
90 }}
91 >
92 Posts
93 </Link>{' '}
94 <Link
95 to="/users"
96 activeProps={{
97 class: 'font-bold',
98 }}
99 >
100 Users
101 </Link>{' '}
102 <Link
103 to="/layout-a"
104 activeProps={{
105 class: 'font-bold',
106 }}
107 >
108 Layout
109 </Link>{' '}
110 <Link
111 to="/scripts"
112 activeProps={{
113 class: 'font-bold',
114 }}
115 >
116 Scripts
117 </Link>{' '}
118 <Link
119 to="/inline-scripts"
120 activeProps={{
121 class: 'font-bold',
122 }}
123 >
124 Inline Scripts
125 </Link>{' '}
126 <Link
127 to="/deferred"
128 activeProps={{
129 class: 'font-bold',
130 }}
131 >
132 Deferred
133 </Link>{' '}
134 <Link
135 to="/redirect"
136 activeProps={{
137 class: 'font-bold',
138 }}
139 >
140 redirect
141 </Link>{' '}
142 <Link
143 // @ts-expect-error
144 to="/this-route-does-not-exist"
145 activeProps={{
146 class: 'font-bold',
147 }}
148 >
149 This Route Does Not Exist
150 </Link>
151 </div>
152 <Outlet />
153 <div class="inline-div">This is an inline styled div</div>
154 <TanStackRouterDevtoolsInProd />
155 <Scripts />
156 </body>
157 </html>
158 )
159}