From c4b54ed36c2da54457ac58496e62e13856bc0c98 Mon Sep 17 00:00:00 2001 From: Manuel <30572287+manuel-rw@users.noreply.github.com> Date: Wed, 26 Jun 2024 12:19:05 +0200 Subject: [PATCH] fix: open navigation item by default (#716) --- .../src/components/layout/navigation-link.tsx | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/apps/nextjs/src/components/layout/navigation-link.tsx b/apps/nextjs/src/components/layout/navigation-link.tsx index c65f9381c..6aec0a9f1 100644 --- a/apps/nextjs/src/components/layout/navigation-link.tsx +++ b/apps/nextjs/src/components/layout/navigation-link.tsx @@ -35,19 +35,24 @@ const NavLinkHref = (props: NavigationLinkHref) => { ); }; -const NavLinkWithItems = (props: NavigationLinkWithItems) => ( - - {props.items.map((item) => ( - - ))} - -); +const NavLinkWithItems = (props: NavigationLinkWithItems) => { + const pathname = usePathname(); + const isActive = props.items.some((item) => item.href === pathname); + return ( + + {props.items.map((item) => ( + + ))} + + ); +}; interface CommonNavigationLinkProps { label: string;