Skip to content

Commit

Permalink
fix: Make navigation menu use next-link instead of a tag
Browse files Browse the repository at this point in the history
  • Loading branch information
hampfh committed Mar 10, 2024
1 parent f190045 commit b51906e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/components/shared/NavigationMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,16 @@ export function NavigationMenu(
const ListItem = React.forwardRef<
React.ElementRef<"a">,
React.ComponentPropsWithoutRef<"a">
>(({ className, title, children, ...props }, ref) => {
>(({ className, href, title, children, ...props }, ref) => {
if (href == null) {
console.error("ListItem: href is required")
return null
}
return (
<li>
<NavigationMenuLink asChild>
<a
<Link
href={href}
ref={ref}
className={cn(
"block select-none space-y-1 rounded-md p-3 leading-none no-underline outline-none transition-colors hover:bg-stone-900",
Expand All @@ -238,7 +243,7 @@ const ListItem = React.forwardRef<
<p className="line-clamp-2 text-sm leading-snug text-stone-400">
{children}
</p>
</a>
</Link>
</NavigationMenuLink>
</li>
)
Expand Down

0 comments on commit b51906e

Please sign in to comment.