File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change
1
+ import Link from 'next/link'
1
2
import { useRouter } from 'next/router'
2
3
import { useEffect , useState } from 'react'
3
4
import { NavList } from '@primer/react'
@@ -75,20 +76,16 @@ export const SidebarProduct = () => {
75
76
}
76
77
77
78
function NavListItem ( { childPage } : { childPage : ProductTreeNode } ) {
78
- const { push , asPath, locale } = useRouter ( )
79
+ const { asPath, locale } = useRouter ( )
79
80
const routePath = `/${ locale } ${ asPath . split ( '?' ) [ 0 ] . split ( '#' ) [ 0 ] } `
80
81
const isActive = routePath === childPage . href
81
82
82
83
return (
83
84
< NavList . Item
84
85
defaultOpen = { childPage . childPages . length > 0 && routePath . includes ( childPage . href ) }
85
86
href = { childPage . href }
87
+ as = { Link }
86
88
aria-current = { isActive ? 'page' : false }
87
- onClick = { ( event ) => {
88
- // XXX TODO: If the `childPage.href` is an external link, don't try to do anything fancy here.
89
- event . preventDefault ( )
90
- push ( childPage . href )
91
- } }
92
89
>
93
90
{ childPage . title }
94
91
{ childPage . childPages . length > 0 && (
You can’t perform that action at this time.
0 commit comments