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

Function PiPPanel

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

Source from the content-addressed store, hash-verified

311const PiPPanel: Component<{
312 children: JSX.Element
313}> = (props) => {
314 const { panelWidth, setPanelWidth } = useDevtoolsState()
315
316 const pip = usePiPWindow()
317 const theme = useTheme()
318 const themed = createThemed(theme)
319
320 let panelRef!: HTMLDivElement
321 onMount(() => {
322 attachStyles(panelRef)
323 })
324
325 createEffect(() => {
326 const win = pip().pipWindow
327 const resizeCB = () => {
328 if (!win) return
329 setPanelWidth(win.innerWidth)
330 }
331 if (win) {
332 win.addEventListener('resize', resizeCB)
333 resizeCB()
334 }
335
336 onCleanup(() => {
337 if (win) {
338 win.removeEventListener('resize', resizeCB)
339 }
340 })
341 })
342
343 return (
344 <div
345 ref={panelRef}
346 dir="ltr"
347 style={{
348 '--tsqd-font-size': '16px',
349 'max-height': '100vh',
350 height: '100vh',
351 width: '100vw',
352 }}
353 class={`${themed('tsqd-style-panel')} ${themed(panelWidth() < secondBreakpoint ? 'tsqd-style-panel-column' : 'tsqd-style-panel-row')} ${panelWidth() < thirdBreakpoint ? 'tsqd-style-panel-min-content' : ''} tsqd-main-panel`}
354 >
355 {props.children}
356 </div>
357 )
358}
359
360/**
361 * The container of the embedded devtools panel, which tracks its width for

Callers

nothing calls this directly

Calls 6

useDevtoolsStateFunction · 0.90
usePiPWindowFunction · 0.90
useThemeFunction · 0.90
createThemedFunction · 0.90
attachStylesFunction · 0.90
resizeCBFunction · 0.85

Tested by

no test coverage detected