noway.moe/src/components/HeaderLink.astro

26 lines
549 B
Plaintext
Raw Normal View History

2023-12-25 20:01:37 -07:00
---
import type { HTMLAttributes } from 'astro/types';
type Props = HTMLAttributes<'a'>;
const { href, class: className, ...props } = Astro.props;
const { pathname } = Astro.url;
const isActive = href === pathname || href === pathname.replace(/\/$/, '');
---
2023-12-26 20:57:47 -07:00
<a class="header-link" href={href} class="hover:underline" {...props}>
2023-12-25 20:01:37 -07:00
<slot />
</a>
2023-12-25 22:08:17 -07:00
2023-12-26 20:57:47 -07:00
<style is:inline>
a.header-link {
2023-12-25 20:01:37 -07:00
display: inline-block;
text-decoration: none;
}
2023-12-26 20:57:47 -07:00
a.header-link:hover {
2023-12-25 20:01:37 -07:00
text-decoration: underline;
2023-12-26 20:57:47 -07:00
text-decoration-color: var(--accent-color);
2023-12-25 20:01:37 -07:00
}
</style>