MCPcopy
hub / github.com/TanStack/query / ParentPanel

Function ParentPanel

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

Source from the content-addressed store, hash-verified

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

Used in the wild real call sites across dependent graphs

searching dependent graphs…