Files
twitter-lite/src/routes/__root.tsx
T

57 lines
1.3 KiB
TypeScript

import type { QueryClient } from '@tanstack/react-query'
import {
createRootRouteWithContext,
HeadContent,
Outlet,
Scripts,
} from '@tanstack/react-router'
import { WorkspaceStateProvider } from '#/features/workspace/workspace-state'
import appCss from '../styles.css?url'
type RouterContext = { queryClient: QueryClient }
export const Route = createRootRouteWithContext<RouterContext>()({
head: () => ({
meta: [
{ charSet: 'utf-8' },
{
name: 'viewport',
content: 'width=device-width, initial-scale=1',
},
{ name: 'referrer', content: 'no-referrer' },
{ title: 'Twitter Lite' },
],
links: [
{ rel: 'stylesheet', href: appCss },
{
rel: 'icon',
href: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='7' fill='%23255f6e'/%3E%3C/svg%3E",
},
],
}),
shellComponent: RootDocument,
component: RootContent,
})
function RootContent() {
return (
<WorkspaceStateProvider>
<Outlet />
</WorkspaceStateProvider>
)
}
function RootDocument({ children }: { children: React.ReactNode }) {
return (
<html lang="en" className="dark">
<head>
<HeadContent />
</head>
<body>
{children}
<Scripts />
</body>
</html>
)
}