Download react-query/packages/query-devtools/src/DevtoolsPanelComponent.tsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.44 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-query/packages/query-devtools/src/DevtoolsPanelComponent.tsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-query/packages/query-devtools/src/DevtoolsPanelComponent.tsx
-
curl -L -o DevtoolsPanelComponent.tsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-query/packages/query-devtools/src/DevtoolsPanelComponent.tsx
1.44 kB
| import { createLocalStorage } from '@solid-primitives/storage' | |
| import { createMemo } from 'solid-js' | |
| import { ContentView, ParentPanel } from './Devtools' | |
| import { getPreferredColorScheme } from './utils' | |
| import { THEME_PREFERENCE } from './constants' | |
| import { PiPProvider, QueryDevtoolsContext, ThemeContext } from './contexts' | |
| import type { DevtoolsComponentType } from './Devtools' | |
| const DevtoolsPanelComponent: DevtoolsComponentType = (props) => { | |
| const [localStore, setLocalStore] = createLocalStorage({ | |
| prefix: 'TanstackQueryDevtools', | |
| }) | |
| const colorScheme = getPreferredColorScheme() | |
| const theme = createMemo(() => { | |
| const preference = (localStore.theme_preference || THEME_PREFERENCE) as | |
| | 'system' | |
| | 'dark' | |
| | 'light' | |
| if (preference !== 'system') return preference | |
| return colorScheme() | |
| }) | |
| return ( | |
| <QueryDevtoolsContext.Provider value={props}> | |
| <PiPProvider | |
| disabled | |
| localStore={localStore} | |
| setLocalStore={setLocalStore} | |
| > | |
| <ThemeContext.Provider value={theme}> | |
| <ParentPanel> | |
| <ContentView | |
| localStore={localStore} | |
| setLocalStore={setLocalStore} | |
| onClose={props.onClose} | |
| showPanelViewOnly | |
| /> | |
| </ParentPanel> | |
| </ThemeContext.Provider> | |
| </PiPProvider> | |
| </QueryDevtoolsContext.Provider> | |
| ) | |
| } | |
| export default DevtoolsPanelComponent | |