Open History to see the last commit
1/// <reference types="vite/client" />
2import { TanStackRouterDevtools } from '@tanstack/react-router-devtools'
3import {
4 HeadContent,
5 Outlet,
6 Scripts,
7 createRootRoute,
8} from '@tanstack/react-router'
9import { CacheProvider } from '@emotion/react'
10import { Container, CssBaseline, ThemeProvider } from '@mui/material'
11import createCache from '@emotion/cache'
12import fontsourceVariableRobotoCss from '@fontsource-variable/roboto?url'
13import React from 'react'
14import { theme } from '~/setup/theme'
15import { Header } from '~/components/Header'
16β
17export const Route = createRootRoute({
18 head: () => ({
19 links: [{ rel: 'stylesheet', href: fontsourceVariableRobotoCss }],
20 }),
21 component: RootComponent,
22})
23β
24function RootComponent() {
25 return (
26 <RootDocument>
27 <Outlet />
28 </RootDocument>
29 )
30}
31β
32function Providers({ children }: { children: React.ReactNode }) {
33 const emotionCache = createCache({ key: 'css' })
34β
35 return (
36 <CacheProvider value={emotionCache}>
37 <ThemeProvider theme={theme}>
38 <CssBaseline />
39 {children}
40 </ThemeProvider>
41 </CacheProvider>
42 )
43}
44β
45function RootDocument({ children }: { children: React.ReactNode }) {
46 return (
47 <html>
48 <head>
49 <HeadContent />
50 </head>
51 <body>
52 <Providers>
53 <Header />
54β
55 <Container component="main" sx={{ paddingBlock: 4 }}>
56 {children}
57 </Container>
58 </Providers>
59β
60 <TanStackRouterDevtools position="bottom-right" />
61 <Scripts />
62 </body>
63 </html>
64 )
65}