|
1 | 1 | 'use client' |
2 | 2 |
|
3 | | -import { Code, GraduationCap, Library } from 'lucide-react' |
4 | 3 | import Link from 'next/link' |
5 | 4 | import { usePathname } from 'next/navigation' |
6 | 5 | // NEWS DISABLED: Uncomment these imports when re-enabling news |
@@ -75,12 +74,6 @@ const referenceSections = [ |
75 | 74 | }, |
76 | 75 | ] |
77 | 76 |
|
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 | | - |
84 | 77 | // Flat list of all sections for compatibility with layout.tsx |
85 | 78 | export const sections = [...learnSections, ...buildSections, ...referenceSections] |
86 | 79 |
|
@@ -114,53 +107,38 @@ export function DocSidebar({ |
114 | 107 | // fetchNews() |
115 | 108 | // }, []) |
116 | 109 | 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"> |
121 | 113 | <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" |
123 | 115 | > |
124 | | - <group.icon className="h-3.5 w-3.5" /> |
125 | | - {group.label} |
| 116 | + {section.title} |
126 | 117 | </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 | + )} |
134 | 136 | > |
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 | + )} |
164 | 142 | </div> |
165 | 143 | ))} |
166 | 144 | </nav> |
|
0 commit comments