diff --git a/src/components/clinical-dashboard/search-results-header-band.tsx b/src/components/clinical-dashboard/search-results-header-band.tsx index 374f4df8..e93b148c 100644 --- a/src/components/clinical-dashboard/search-results-header-band.tsx +++ b/src/components/clinical-dashboard/search-results-header-band.tsx @@ -1,6 +1,6 @@ "use client"; -import { Bookmark, LayoutList, Search, Table2, X } from "lucide-react"; +import { Bookmark, ChevronsUpDown, LayoutList, Search, Table2, X } from "lucide-react"; import { searchCommandSurfaceConfig } from "@/lib/search-command-surface"; import { cn } from "@/components/ui-primitives"; @@ -141,21 +141,27 @@ export function ResultSortControl({ return ( ); } diff --git a/src/components/clinical-dashboard/universal-search-also-matches.tsx b/src/components/clinical-dashboard/universal-search-also-matches.tsx index aacee86b..8cf33015 100644 --- a/src/components/clinical-dashboard/universal-search-also-matches.tsx +++ b/src/components/clinical-dashboard/universal-search-also-matches.tsx @@ -1,6 +1,8 @@ "use client"; import Link from "next/link"; +import { ChevronDown } from "lucide-react"; +import { useEffect, useId, useState } from "react"; import { useUniversalSearch } from "@/components/clinical-dashboard/use-universal-search"; import { cn } from "@/components/ui-primitives"; @@ -25,6 +27,23 @@ export function UniversalSearchAlsoMatches({ excludeDomains: universalSearchPreferredDomains(modeId), limitPerDomain: 2, }); + const panelId = useId(); + // Collapsed by default on phones so this cross-mode panel does not push the + // primary results down; desktop always shows the grid (see the sm: rules below), + // so the toggle state only governs the narrow-viewport disclosure. + const [expanded, setExpanded] = useState(false); + // Track the sm breakpoint (640px) so the header's disclosure semantics match + // reality: on desktop the grid is always visible, so the button reports + // expanded and drops out of the interaction/tab flow rather than claiming to + // be a collapsed control the user can toggle to no effect. + const [isWide, setIsWide] = useState(false); + useEffect(() => { + const query = window.matchMedia("(min-width: 640px)"); + const sync = () => setIsWide(query.matches); + sync(); + query.addEventListener("change", sync); + return () => query.removeEventListener("change", sync); + }, []); const preferred = new Set(universal.preferredDomains ?? []); const groups = (() => { const groupByDomain = new Map(universal.groups.map((group) => [group.kind, group])); @@ -63,11 +82,40 @@ export function UniversalSearchAlsoMatches({ aria-label="Matches in other modes" data-testid="universal-also-matches" > -
Also matches in other modes
- Across Clinical KB -