forked from solidjs/solid-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.tsx
More file actions
50 lines (47 loc) · 1.35 KB
/
app.tsx
File metadata and controls
50 lines (47 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// @refresh reload
import { Router } from "@solidjs/router";
import { FileRoutes } from "@solidjs/start/router";
import { MDXProvider } from "solid-mdx";
import { ErrorBoundary, Suspense, createEffect } from "solid-js";
import { MetaProvider, Title } from "@solidjs/meta";
import Md from "~/ui/markdown-components";
import { Layout } from "~/ui/layout";
import { ThemeProvider, useThemeContext } from "./data/theme-provider";
import { I18nProvider } from "@kobalte/core";
import { NotFound } from "./ui/not-found";
import "~/styles.css";
export default function App() {
return (
<ThemeProvider>
{(() => {
const ctx = useThemeContext();
createEffect(() => {
const html = document.documentElement;
html.classList.remove("light", "dark");
html.classList.add(ctx.selectedTheme()!.value);
html.dataset.theme = ctx.selectedTheme()!.theme;
});
return (
<Router
root={(props) => (
<I18nProvider>
<MetaProvider>
<Title>Solid Docs</Title>
<ErrorBoundary fallback={<NotFound />}>
<Layout>
<MDXProvider components={Md}>
<Suspense>{props.children}</Suspense>
</MDXProvider>
</Layout>
</ErrorBoundary>
</MetaProvider>
</I18nProvider>
)}
>
<FileRoutes />
</Router>
);
})()}
</ThemeProvider>
);
}