fix: fixed active links in header

This commit is contained in:
Sergey Yarkov 2022-08-18 23:42:35 +03:00
parent c518a698db
commit eaac35a0c3

View File

@ -1,6 +1,7 @@
--- ---
import { Icon } from "astro-icon"; import { Icon } from "astro-icon";
import { IS_SITE_UNDER_CONSTRUCTION, SITE_METADATA } from "@root/config"; import { IS_SITE_UNDER_CONSTRUCTION, SITE_METADATA } from "@root/config";
import { removeSlashes } from "@utils/string";
import ThemeSwitcher from "@components/ThemeSwticher"; import ThemeSwitcher from "@components/ThemeSwticher";
import UIString from "@components/UIString"; import UIString from "@components/UIString";
import TranslatedLink from "@components/TranslatedLink"; import TranslatedLink from "@components/TranslatedLink";
@ -24,7 +25,7 @@ const { pathname } = Astro.url;
{ {
nav.map((link) => ( nav.map((link) => (
<li> <li>
<TranslatedLink class={link.url.includes(pathname) && pathname !== '/' && "active"} to={link.url}> <TranslatedLink class={pathname.includes(removeSlashes(link.url)) && pathname.split('/').length < 5 && "active"} to={link.url}>
<UIString key={link.key} /> <UIString key={link.key} />
</TranslatedLink> </TranslatedLink>
</li> </li>