Skip to content

Commit 0b88298

Browse files
committed
Close mobile menu on link click
1 parent 6f52538 commit 0b88298

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/app/conf/2025/components/navbar.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { Badge } from "../../_components/badge"
1010
import MenuIcon from "../pixelarticons/menu.svg?svgr"
1111
import CloseIcon from "../pixelarticons/close.svg?svgr"
1212
import { GraphQLConfLogoLink } from "./graphql-conf-logo-link"
13+
import { Anchor } from "../../_design-system/anchor"
1314

1415
export interface NavbarProps {
1516
links: { href: string; children: React.ReactNode; "aria-disabled"?: true }[]
@@ -79,27 +80,27 @@ export function Navbar({ links, year }: NavbarProps): ReactElement {
7980
<div className="flex w-full flex-col lg:mt-0 lg:block">
8081
{links.map(
8182
({ "aria-disabled": isDisabled, children, ...link }) => (
82-
<NextLink
83+
<Anchor
8384
aria-disabled={isDisabled}
8485
key={link.href}
8586
{...link}
86-
// if external link, open in new tab
87-
{...(link.href.startsWith("https") && {
88-
target: "_blank",
89-
rel: "noopener noreferrer",
90-
})}
9187
className={clsx(
9288
"p-5 underline-offset-4 hover:underline aria-disabled:pointer-events-none max-lg:text-base",
9389
pathname === link.href && "underline",
9490
)}
91+
onClick={() => {
92+
if (mobileDrawerOpen) {
93+
setMobileDrawerOpen(false)
94+
}
95+
}}
9596
>
9697
{children}
9798
{isDisabled && (
9899
<sup className="ml-2">
99100
<Badge className="text-white">Soon</Badge>
100101
</sup>
101102
)}
102-
</NextLink>
103+
</Anchor>
103104
),
104105
)}
105106
</div>

0 commit comments

Comments
 (0)