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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected