Skip to content

Commit 16d3dfd

Browse files
committed
refactor(web): simplify doc sidebar by removing group headers
- Remove Learn/Build/Reference group headers and icons - Show section titles directly as non-selectable category labels - Flatten sidebar structure for cleaner navigation
1 parent 1777898 commit 16d3dfd

File tree

1 file changed

+28
-50
lines changed

1 file changed

+28
-50
lines changed

web/src/components/docs/doc-sidebar.tsx

Lines changed: 28 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
'use client'
22

3-
import { Code, GraduationCap, Library } from 'lucide-react'
43
import Link from 'next/link'
54
import { usePathname } from 'next/navigation'
65
// NEWS DISABLED: Uncomment these imports when re-enabling news
@@ -75,12 +74,6 @@ const referenceSections = [
7574
},
7675
]
7776

78-
export const sectionGroups = [
79-
{ label: 'Learn', icon: GraduationCap, sections: learnSections },
80-
{ label: 'Build', icon: Code, sections: buildSections },
81-
{ label: 'Reference', icon: Library, sections: referenceSections },
82-
]
83-
8477
// Flat list of all sections for compatibility with layout.tsx
8578
export const sections = [...learnSections, ...buildSections, ...referenceSections]
8679

@@ -114,53 +107,38 @@ export function DocSidebar({
114107
// fetchNews()
115108
// }, [])
116109
return (
117-
<nav className={cn('space-y-6', className)}>
118-
{sectionGroups.map((group, groupIndex) => (
119-
<div key={group.label} className="space-y-3">
120-
{/* Group header */}
110+
<nav className={cn('space-y-4', className)}>
111+
{sections.map((section) => (
112+
<div key={section.href} className="space-y-1">
121113
<div
122-
className="px-3 flex items-center gap-2 text-xs font-semibold uppercase tracking-wider text-muted-foreground/70 select-none pointer-events-none"
114+
className="block px-3 py-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground/60 select-none"
123115
>
124-
<group.icon className="h-3.5 w-3.5" />
125-
{group.label}
116+
{section.title}
126117
</div>
127-
128-
{/* Sections within group */}
129-
<div className="space-y-4">
130-
{group.sections.map((section) => (
131-
<div key={section.href} className="space-y-1">
132-
<div
133-
className="block px-3 py-2 text-sm font-medium select-none"
118+
{section.subsections && section.subsections.length > 0 && (
119+
<div className="ml-4 space-y-1">
120+
{section.subsections.map((subsection) => (
121+
<Link
122+
key={subsection.href}
123+
href={subsection.href}
124+
target={section.external ? '_blank' : undefined}
125+
onClick={() => {
126+
const sheet =
127+
document.querySelector('[data-state="open"]')
128+
if (sheet) sheet.setAttribute('data-state', 'closed')
129+
onNavigate?.()
130+
}}
131+
className={cn(
132+
'block w-full text-left px-3 py-1.5 text-sm hover:bg-accent rounded-md transition-all text-muted-foreground hover:text-foreground',
133+
pathname === subsection.href &&
134+
'bg-accent text-accent-foreground',
135+
)}
134136
>
135-
{section.title}
136-
</div>
137-
{section.subsections && section.subsections.length > 0 && (
138-
<div className="ml-4 space-y-1">
139-
{section.subsections.map((subsection) => (
140-
<Link
141-
key={subsection.href}
142-
href={subsection.href}
143-
target={section.external ? '_blank' : undefined}
144-
onClick={() => {
145-
const sheet =
146-
document.querySelector('[data-state="open"]')
147-
if (sheet) sheet.setAttribute('data-state', 'closed')
148-
onNavigate?.()
149-
}}
150-
className={cn(
151-
'block w-full text-left px-3 py-1.5 text-sm hover:bg-accent rounded-md transition-all text-muted-foreground hover:text-foreground',
152-
pathname === subsection.href &&
153-
'bg-accent text-accent-foreground',
154-
)}
155-
>
156-
{subsection.title}
157-
</Link>
158-
))}
159-
</div>
160-
)}
161-
</div>
162-
))}
163-
</div>
137+
{subsection.title}
138+
</Link>
139+
))}
140+
</div>
141+
)}
164142
</div>
165143
))}
166144
</nav>

0 commit comments

Comments
 (0)