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

Function Header

examples/react/start/src/components/Header.tsx:21–187  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected