MCPcopy Create free account
hub / github.com/TanStack/query / ParentPanel

Function ParentPanel

packages/query-devtools/src/Devtools.tsx:353–408  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

351export const ParentPanel: Component<{
352 children: JSX.Element
353}> = (props) => {
354 const theme = useTheme()
355 const css = useQueryDevtoolsContext().shadowDOMTarget
356 ? goober.css.bind({ target: useQueryDevtoolsContext().shadowDOMTarget })
357 : goober.css
358 const styles = createMemo(() => {
359 return theme() === 'dark' ? darkStyles(css) : lightStyles(css)
360 })
361
362 let panelRef!: HTMLDivElement
363
364 onMount(() => {
365 createResizeObserver(panelRef, ({ width }, el) => {
366 if (el === panelRef) {
367 setPanelWidth(width)
368 }
369 })
370 })
371
372 const getPanelDynamicStyles = () => {
373 const { colors } = tokens
374 const t = (light: string, dark: string) =>
375 theme() === 'dark' ? dark : light
376 if (panelWidth() < secondBreakpoint) {
377 return css`
378 flex-direction: column;
379 background-color: ${t(colors.gray[300], colors.gray[600])};
380 `
381 }
382 return css`
383 flex-direction: row;
384 background-color: ${t(colors.gray[200], colors.darkGray[900])};
385 `
386 }
387
388 return (
389 <div
390 style={{
391 '--tsqd-font-size': '16px',
392 }}
393 ref={panelRef}
394 class={cx(
395 styles().parentPanel,
396 getPanelDynamicStyles(),
397 {
398 [css`
399 min-width: min-content;
400 `]: panelWidth() < thirdBreakpoint,
401 },
402 'tsqd-main-panel',
403 )}
404 >
405 {props.children}
406 </div>
407 )
408}
409
410const DraggablePanel: Component<DevtoolsPanelProps> = (props) => {

Callers

nothing calls this directly

Calls 5

useThemeFunction · 0.90
useQueryDevtoolsContextFunction · 0.90
getPanelDynamicStylesFunction · 0.85
darkStylesFunction · 0.70
lightStylesFunction · 0.70

Tested by

no test coverage detected