From a1141d65463064119b22276dfa4e9a2e13a5cdc3 Mon Sep 17 00:00:00 2001 From: Mardav Wala Date: Fri, 29 Jul 2022 10:15:46 -0400 Subject: [PATCH] docs: NavList example with next/link's URL object Adding another use-case in the NavList's NextJS example --- docs/content/NavList.mdx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/content/NavList.mdx b/docs/content/NavList.mdx index b016fa8108d..4cc7d78dc2b 100644 --- a/docs/content/NavList.mdx +++ b/docs/content/NavList.mdx @@ -210,7 +210,10 @@ import {NavList} from '@primer/react' function NavItem({href, children}) { const router = useRouter() - const isCurrent = router.asPath === href + const isCurrent = + typeof href === 'string' + ? router.asPath === href + : router.pathname === href.pathname; return ( {children} @@ -224,6 +227,14 @@ function App() { Dashboard Pull requests Issues + + Summary + ) }