File tree Expand file tree Collapse file tree 3 files changed +17
-7
lines changed
apps/web/src/components/Navigation Expand file tree Collapse file tree 3 files changed +17
-7
lines changed Original file line number Diff line number Diff line change 1- import { useEffect , useState } from 'react'
2- import { usePathname } from 'next/navigation'
31import clsx from 'clsx'
42import { ChevronDown , ChevronRight } from 'lucide-react'
3+ import { usePathname } from 'next/navigation'
4+ import { useEffect , useState } from 'react'
55
6- import { NavSubgroup } from './routes'
76import { NavigationLink } from './NavigationLink'
7+ import { NavSubgroup } from './routes'
88
99export function NavigationSubgroup ( { subgroup } : { subgroup : NavSubgroup } ) {
1010 const [ isExpanded , setIsExpanded ] = useState ( false )
1111 const pathname = usePathname ( )
1212
13- const isActive = subgroup . links . some ( link => link . href === pathname )
13+ console . log ( 'subgroup' , subgroup )
14+ const isActive = subgroup . links . some ( ( link ) => link . href === pathname )
1415
1516 // Automatically expand the subgroup if it's active
1617 useEffect ( ( ) => {
@@ -36,7 +37,9 @@ export function NavigationSubgroup({ subgroup }: { subgroup: NavSubgroup }) {
3637 >
3738 < div className = "flex items-center justify-start gap-1" >
3839 { subgroup . icon }
39- < h3 className = "text-sm font-medium group-hover:text-white" > { subgroup . title } </ h3 >
40+ < h3 className = "text-sm font-medium group-hover:text-white" >
41+ { subgroup . title }
42+ </ h3 >
4043 </ div >
4144 { isExpanded ? (
4245 < ChevronDown className = "w-4 h-4 ml-2 text-zinc-400 group-hover:text-white" />
Original file line number Diff line number Diff line change @@ -143,7 +143,14 @@ function VersionedNavigationGroup({
143143 < >
144144 { group . versionedItems [ curVersion ] ?. map ( ( item ) => (
145145 < React . Fragment key = { item . title } >
146- < NavigationSubgroup subgroup = { item as NavSubgroup } />
146+ { ( item as any ) . links ? (
147+ < NavigationSubgroup subgroup = { item as NavSubgroup } />
148+ ) : (
149+ < NavigationLink
150+ link = { item as NavLink }
151+ className = "font-medium"
152+ />
153+ ) }
147154 </ React . Fragment >
148155 ) ) }
149156 </ >
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ export interface NavGroup {
2222export interface VersionedNavGroup {
2323 title ?: string
2424 icon ?: React . ReactNode
25- versionedItems : { [ key : string ] : NavSubgroup [ ] }
25+ versionedItems : { [ key : string ] : Array < NavLink | NavSubgroup > }
2626}
2727
2828export const docRoutes : NavGroup [ ] = [
You can’t perform that action at this time.
0 commit comments