Skip to content

Commit 36a52fa

Browse files
committed
fix: update navbar link activation logic for improved navigation feedback
1 parent 39de35a commit 36a52fa

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/components/Navbar.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const navLinks = [
2121
<ul class="menu menu-horizontal px-1">
2222
{navLinks.map((link) => (
2323
<li>
24-
<a href={link.href} class:list={[{ 'active': currentPath.startsWith(link.href) }]}>
24+
<a href={link.href} class:list={[currentPath === link.href || currentPath === `${link.href}/` || currentPath.startsWith(link.href + '/') ? 'menu-active' : null]}>
2525
{link.label}
2626
</a>
2727
</li>
@@ -53,7 +53,7 @@ const navLinks = [
5353
<ul tabindex="0" class="menu menu-sm dropdown-content mt-3 z-[1] p-2 shadow bg-base-100 rounded-box w-52">
5454
{navLinks.map((link) => (
5555
<li>
56-
<a href={link.href} class:list={[{ 'active': currentPath.startsWith(link.href) }]}>
56+
<a href={link.href} class:list={[currentPath === link.href || currentPath === `${link.href}/` || currentPath.startsWith(link.href + '/') ? 'menu-active' : null]}>
5757
{link.label}
5858
</a>
5959
</li>

0 commit comments

Comments
 (0)