2024-12-23 21:18:55 +00:00
|
|
|
---
|
|
|
|
import { SITE } from "@consts";
|
|
|
|
import { Icon } from "astro-icon/components";
|
2025-02-13 16:55:09 +00:00
|
|
|
|
|
|
|
const pathname = new URL(Astro.request.url).pathname;
|
|
|
|
const currentPath = pathname.replace(/\/$/, "");
|
2024-12-23 21:18:55 +00:00
|
|
|
---
|
|
|
|
|
2025-02-13 16:55:09 +00:00
|
|
|
<header class="mx-auto mb-8 w-full max-w-[65ch] space-y-6 md:pt-4">
|
2025-02-12 13:03:43 +00:00
|
|
|
<nav
|
2025-02-13 16:55:09 +00:00
|
|
|
class="md:flex-no-wrap flex w-full flex-wrap justify-between"
|
|
|
|
x-data="{ open: false }"
|
2024-12-23 21:18:55 +00:00
|
|
|
>
|
2025-02-13 16:55:09 +00:00
|
|
|
<div class="flex w-full items-center justify-between md:w-fit">
|
|
|
|
<a href="/" title={SITE.TITLE}>
|
|
|
|
<Icon
|
|
|
|
name="icon"
|
|
|
|
title={SITE.TITLE}
|
|
|
|
class="hover:text-tertiary h-8 w-auto transition-colors duration-500 ease-in-out"
|
|
|
|
/>
|
|
|
|
</a>
|
|
|
|
<button
|
|
|
|
x-on:click="open = !open"
|
|
|
|
x-bind:aria-expanded="open"
|
|
|
|
type="button"
|
|
|
|
class="text-secondary flex md:hidden"
|
|
|
|
aria-label="mobile menu"
|
|
|
|
aria-controls="mobileMenu"
|
|
|
|
>
|
|
|
|
<Icon
|
|
|
|
name="mdi:menu"
|
|
|
|
aria-hidden="true"
|
|
|
|
class="size-6"
|
|
|
|
x-cloak
|
|
|
|
x-show="!open"
|
|
|
|
/>
|
|
|
|
<Icon
|
|
|
|
name="mdi:window-close"
|
|
|
|
aria-hidden="true"
|
|
|
|
class="size-6"
|
|
|
|
x-cloak
|
|
|
|
x-show="open"
|
|
|
|
/>
|
|
|
|
</button>
|
|
|
|
</div>
|
2025-02-12 13:03:43 +00:00
|
|
|
<ul
|
2025-02-13 17:06:23 +00:00
|
|
|
class="my-4 flex w-full flex-col items-center gap-4 text-right md:my-0 md:flex md:w-fit md:flex-row md:text-left"
|
2025-02-13 16:55:09 +00:00
|
|
|
x-bind:class="{ 'hidden': !open }"
|
2025-02-12 13:03:43 +00:00
|
|
|
x-cloak
|
|
|
|
>
|
|
|
|
{
|
2025-02-13 16:55:09 +00:00
|
|
|
SITE.NAVLINKS.map((link) => {
|
|
|
|
let linkHref = link.href.replace(/\/$/, "");
|
|
|
|
const isActive = currentPath.startsWith(linkHref);
|
|
|
|
return (
|
2025-02-13 17:06:23 +00:00
|
|
|
<li class="text-tertiary hover:text-secondary focus:text-secondary text-2xl font-medium capitalize transition-colors duration-300 focus:outline-hidden md:text-base">
|
2025-02-13 16:55:09 +00:00
|
|
|
<a
|
|
|
|
href={link.href}
|
|
|
|
class:list={[isActive ? "text-secondary" : ""]}
|
|
|
|
>
|
|
|
|
{link.name}
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
);
|
|
|
|
})
|
2025-02-12 13:03:43 +00:00
|
|
|
}
|
|
|
|
</ul>
|
|
|
|
</nav>
|
2024-12-23 21:18:55 +00:00
|
|
|
</header>
|