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

__root.tsx

69 lines1.5 KB

1import {
2 HeadContent,
3 Link,
4 Outlet,
5 Scripts,
6 createRootRoute,
7} from '@tanstack/solid-router'
8import { HydrationScript } from 'solid-js/web'
9​
10export const Route = createRootRoute({
11 head: () => ({
12 meta: [
13 { charSet: 'utf-8' },
14 { name: 'viewport', content: 'width=device-width, initial-scale=1' },
15 ],
16 }),
17 component: RootComponent,
18})
19​
20function RootComponent() {
21 return (
22 <html>
23 <head>
24 <HydrationScript />
25 <HeadContent />
26 </head>
27 <body>
28 <nav
29 data-testid="main-nav"
30 style={{
31 padding: '12px 20px',
32 'border-bottom': '1px solid #e2e8f0',
33 display: 'flex',
34 'align-items': 'center',
35 gap: '16px',
36 'background-color': '#fff',
37 }}
38 >
39 <Link
40 to="/"
41 style={{ color: '#0284c7', 'text-decoration': 'none' }}
42 data-testid="nav-home"
43 >
44 Home (Global CSS)
45 </Link>
46 <Link
47 to="/modules"
48 style={{ color: '#0284c7', 'text-decoration': 'none' }}
49 data-testid="nav-modules"
50 >
51 CSS Modules
52 </Link>
53 <Link
54 to="/sass-mixin"
55 style={{ color: '#0284c7', 'text-decoration': 'none' }}
56 data-testid="nav-sass-mixin"
57 >
58 Sass Mixin
59 </Link>
60 </nav>
61​
62 <main style={{ padding: '20px' }}>
63 <Outlet />
64 </main>
65 <Scripts />
66 </body>
67 </html>
68 )