MCPcopy Create free account
hub / github.com/TanStack/devtools / App

Function App

examples/solid/devtools-ui/src/index.tsx:23–60  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

21const darkThemeMq = window.matchMedia('(prefers-color-scheme: dark)')
22
23function App() {
24 const [theme, setTheme] = createSignal<TanStackDevtoolsTheme>(
25 darkThemeMq.matches ? 'dark' : 'light',
26 )
27
28 createEffect(() => {
29 document.documentElement.setAttribute('data-theme', theme())
30 })
31
32 const toggleTheme = () => {
33 setTheme((prev) => (prev === 'dark' ? 'light' : 'dark'))
34 }
35
36 return (
37 <div class="app-shell">
38 <button type="button" class="theme-toggle" onClick={toggleTheme}>
39 Toggle theme ({theme()})
40 </button>
41
42 <ThemeContextProvider theme={theme()}>
43 <h1>Json tree - dates</h1>
44
45 <div class="json-tree-container">
46 <JsonTree
47 value={JsonTreeDate}
48 config={{ dateFormat: 'DD-MM-YYYY' }}
49 />
50 </div>
51
52 <h1>Json tree - paths</h1>
53
54 <div class="json-tree-container">
55 <JsonTree value={JsonTreePath} collapsePaths={['foo']} />
56 </div>
57 </ThemeContextProvider>
58 </div>
59 )
60}
61
62const root = document.getElementById('root')
63if (root) render(() => <App />, root)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected