fix: change the conditions on which links in the header are marked as active
This commit is contained in:
parent
074ccb9422
commit
68f45963ee
1 changed files with 2 additions and 2 deletions
|
@ -35,7 +35,7 @@ function Header({ docLinks }) {
|
||||||
<Link
|
<Link
|
||||||
href={navLink.href}
|
href={navLink.href}
|
||||||
target={navLink.target}
|
target={navLink.target}
|
||||||
className={`inline-block self-center ${pathname == navLink.href ? "bg-accent" : ""} text-inherit px-2 py-1.5 mx-1 rounded-sm hover:bg-accent/60 transition-colors`}
|
className={`inline-block self-center ${pathname == navLink.href || (navLink.href != "/" && pathname.indexOf(navLink.href + "/") == 0) ? "bg-accent" : ""} text-inherit px-2 py-1.5 mx-1 rounded-sm hover:bg-accent/60 transition-colors`}
|
||||||
>
|
>
|
||||||
{navLink.label}
|
{navLink.label}
|
||||||
</Link>
|
</Link>
|
||||||
|
@ -131,7 +131,7 @@ function Header({ docLinks }) {
|
||||||
<Link
|
<Link
|
||||||
href={navLink.href}
|
href={navLink.href}
|
||||||
target={navLink.target}
|
target={navLink.target}
|
||||||
className={`inline-block align-middle ${pathname == navLink.href ? "bg-accent" : ""} text-inherit px-2 py-1 h-8 mx-1 rounded-sm hover:bg-accent/60 transition-colors`}
|
className={`inline-block align-middle ${pathname == navLink.href || (navLink.href != "/" && pathname.indexOf(navLink.href + "/") == 0) ? "bg-accent" : ""} text-inherit px-2 py-1 h-8 mx-1 rounded-sm hover:bg-accent/60 transition-colors`}
|
||||||
>
|
>
|
||||||
{navLink.label}
|
{navLink.label}
|
||||||
</Link>
|
</Link>
|
||||||
|
|
Loading…
Reference in a new issue