MCPcopy Create free account
hub / github.com/TanStack/devtools / Header

Function Header

examples/react/bundling-repro/src/components/Header.tsx:21–252  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

19export default function Header() {
20 const [isOpen, setIsOpen] = useState(false)
21 const [groupedExpanded, setGroupedExpanded] = useState<
22 Record<string, boolean>
23 >({})
24
25 return (
26 <>
27 <header className="p-4 flex items-center bg-gray-800 text-white shadow-lg">
28 <button
29 onClick={() => setIsOpen(true)}
30 className="p-2 hover:bg-gray-700 rounded-lg transition-colors"
31 aria-label="Open menu"
32 >
33 <Menu size={24} />
34 </button>
35 <h1 className="ml-4 text-xl font-semibold">
36 <Link to="/">
37 <img
38 src="/tanstack-word-logo-white.svg"
39 alt="TanStack Logo"
40 className="h-10"
41 />
42 </Link>
43 </h1>
44 </header>
45
46 <aside
47 className={`fixed top-0 left-0 h-full w-80 bg-gray-900 text-white shadow-2xl z-50 transform transition-transform duration-300 ease-in-out flex flex-col ${
48 isOpen ? 'translate-x-0' : '-translate-x-full'
49 }`}
50 >
51 <div className="flex items-center justify-between p-4 border-b border-gray-700">
52 <h2 className="text-xl font-bold">Navigation</h2>
53 <button
54 onClick={() => setIsOpen(false)}
55 className="p-2 hover:bg-gray-800 rounded-lg transition-colors"
56 aria-label="Close menu"
57 >
58 <X size={24} />
59 </button>
60 </div>
61
62 <nav className="flex-1 p-4 overflow-y-auto">
63 <Link
64 to="/"
65 onClick={() => setIsOpen(false)}
66 className="flex items-center gap-3 p-3 rounded-lg hover:bg-gray-800 transition-colors mb-2"
67 activeProps={{
68 className:
69 'flex items-center gap-3 p-3 rounded-lg bg-cyan-600 hover:bg-cyan-700 transition-colors mb-2',
70 }}
71 >
72 <Home size={20} />
73 <span className="font-medium">Home</span>
74 </Link>
75
76 {/* Demo Links Start */}
77
78 <Link

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected