From f00adf6fce95aa11e8e59335ab75b2f7a9244537 Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Wed, 9 Jul 2025 14:24:29 -0700 Subject: [PATCH] A bunch of responsiveness fixes --- src-web/components/GraphQLDocsExplorer.tsx | 109 ++++++++++++++------- src-web/components/GraphQLEditor.tsx | 23 +++-- src-web/components/HttpRequestLayout.tsx | 9 +- src-web/components/core/Button.tsx | 6 +- src-web/components/core/Dropdown.tsx | 3 +- src-web/hooks/useIntrospectGraphQL.ts | 2 +- 6 files changed, 104 insertions(+), 48 deletions(-) diff --git a/src-web/components/GraphQLDocsExplorer.tsx b/src-web/components/GraphQLDocsExplorer.tsx index a3ad5fc4..5b6e1634 100644 --- a/src-web/components/GraphQLDocsExplorer.tsx +++ b/src-web/components/GraphQLDocsExplorer.tsx @@ -24,6 +24,7 @@ import { import type { CSSProperties, HTMLAttributes, KeyboardEvent, ReactNode } from 'react'; import { Fragment, memo, useCallback, useMemo, useRef, useState } from 'react'; import { showGraphQLDocExplorerAtom } from '../atoms/graphqlSchemaAtom'; +import { useContainerSize } from '../hooks/useContainerQuery'; import { useDebouncedValue } from '../hooks/useDebouncedValue'; import { useRandomKey } from '../hooks/useRandomKey'; import { useStateWithDeps } from '../hooks/useStateWithDeps'; @@ -61,11 +62,18 @@ export const GraphQLDocsExplorer = memo(function GraphQLDocsExplorer({ const mutItem: ExplorerItem = mutType ? { kind: 'type', type: mutType, from: null } : null; const subItem: ExplorerItem = subType ? { kind: 'type', type: subType, from: null } : null; const allTypes = schema.getTypeMap(); + const containerRef = useRef(null); + const containerSize = useContainerSize(containerRef); return ( -
-
- +
+
+ {activeItem == null ? (
Root Types @@ -120,10 +128,12 @@ function GraphQLExplorerHeader({ item, setItem, schema, + containerHeight, }: { item: ExplorerItem; setItem: (t: ExplorerItem) => void; schema: GraphQLSchema; + containerHeight: number; }) { const findIt = (t: ExplorerItem): ExplorerItem[] => { if (t == null) return [null]; @@ -131,28 +141,37 @@ function GraphQLExplorerHeader({ }; const crumbs = findIt(item); return ( -