troylusty.com/src/components/Header.astro

45 lines
1.3 KiB
Text
Raw Normal View History

2024-12-23 21:18:55 +00:00
---
import { SITE } from "@consts";
import Button from "@components/Button.astro";
2025-02-17 00:14:50 +00:00
import { Icon } from "astro-icon/components";
const pathname = new URL(Astro.request.url).pathname;
const currentPath = pathname.replace(/\/$/, "");
2024-12-23 21:18:55 +00:00
---
2025-02-13 18:55:50 +00:00
<header class="mx-auto w-full">
<nav class="flex w-full justify-between">
2025-06-04 18:51:58 +01:00
<a href="/" aria-label={SITE.TITLE}>
<Icon
name="icon"
class="hover:text-tertiary h-8 w-auto transition-colors duration-500 ease-in-out"
/>
</a>
<ul class="flex w-fit flex-row items-center gap-4">
{
SITE.NAVLINKS.map((link) => {
let linkHref = link.href.replace(/\/$/, "");
const isActive = currentPath.startsWith(linkHref);
return (
2025-03-08 09:48:04 +00:00
<li class="text-tertiary hover:text-secondary focus:text-secondary font-medium transition-colors duration-300 focus:outline-hidden">
<a
href={link.href}
class:list={[
isActive
? "text-secondary hover:text-tertiary transition-colors duration-300"
: null,
]}
>
{link.name}
</a>
</li>
);
})
}
2025-02-16 20:03:52 +00:00
<li>
<Button href={`mailto:${SITE.EMAIL}`} link="Email" />
</li>
</ul>
</nav>
2024-12-23 21:18:55 +00:00
</header>