Skip to content

Commit 435b85f

Browse files
authored
Merge pull request #15095 from ethereum/fix-menu-links
Fix localized menu & breadcrumb links
2 parents e351065 + e11aff4 commit 435b85f

File tree

2 files changed

+27
-28
lines changed

2 files changed

+27
-28
lines changed

src/components/Nav/Menu/SubMenu.tsx

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { AnimatePresence, motion } from "framer-motion"
2-
import NextLink from "next/link"
32
import {
43
Content,
54
Item,
@@ -71,32 +70,30 @@ const SubMenu = ({ lvl, items, activeSection, onClose }: LvlContentProps) => {
7170
<Item key={label} asChild>
7271
<ListItem className={cn("mb-2 last:mb-0", itemClasses())}>
7372
{isLink ? (
74-
<NextLink href={action.href!} passHref legacyBehavior>
75-
<NavigationMenuLink asChild>
76-
<Button
77-
variant="ghost"
78-
className={buttonClasses}
79-
data-active={isActivePage}
80-
onClick={() => {
81-
onClose()
82-
trackCustomEvent({
83-
eventCategory: "Desktop navigation menu",
84-
eventAction: `Menu - ${activeSection} - ${locale}`,
85-
eventName: action.href!,
86-
})
87-
}}
88-
asChild
89-
>
90-
<BaseLink>
91-
{lvl === 1 && Icon ? (
92-
<Icon className="me-4 h-6 w-6" />
93-
) : null}
73+
<NavigationMenuLink asChild>
74+
<Button
75+
variant="ghost"
76+
className={buttonClasses}
77+
data-active={isActivePage}
78+
onClick={() => {
79+
onClose()
80+
trackCustomEvent({
81+
eventCategory: "Desktop navigation menu",
82+
eventAction: `Menu - ${activeSection} - ${locale}`,
83+
eventName: action.href!,
84+
})
85+
}}
86+
asChild
87+
>
88+
<BaseLink href={action.href!}>
89+
{lvl === 1 && Icon ? (
90+
<Icon className="me-4 h-6 w-6" />
91+
) : null}
9492

95-
<ItemContent item={item} lvl={lvl} />
96-
</BaseLink>
97-
</Button>
98-
</NavigationMenuLink>
99-
</NextLink>
93+
<ItemContent item={item} lvl={lvl} />
94+
</BaseLink>
95+
</Button>
96+
</NavigationMenuLink>
10097
) : (
10198
<>
10299
<Trigger asChild>

src/components/ui/breadcrumb.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import * as React from "react"
2-
import Link, { LinkProps } from "next/link"
2+
import { ComponentProps } from "react"
33
import { LuChevronRight, LuMoreHorizontal } from "react-icons/lu"
44
import { Slot } from "@radix-ui/react-slot"
55

66
import { cn } from "@/lib/utils/cn"
77

8+
import { Link } from "@/i18n/routing"
9+
810
interface BreadcrumbProps extends React.ComponentPropsWithoutRef<"nav"> {
911
separator?: React.ReactNode
1012
}
@@ -46,7 +48,7 @@ BreadcrumbItem.displayName = "BreadcrumbItem"
4648
const BreadcrumbLink = React.forwardRef<
4749
HTMLAnchorElement,
4850
React.ComponentPropsWithoutRef<"a"> &
49-
LinkProps & {
51+
ComponentProps<typeof Link> & {
5052
asChild?: boolean
5153
}
5254
>(({ asChild, className, ...props }, ref) => {

0 commit comments

Comments
 (0)