21 lines
434 B
Plaintext
21 lines
434 B
Plaintext
---
|
|
export interface Props extends astroHTML.JSX.AnchorHTMLAttributes {}
|
|
|
|
const { href, class: className, ...props } = Astro.props;
|
|
const isActive = href === Astro.url.pathname.replace(/\/$/, '');
|
|
---
|
|
|
|
<a href={href} class:list={[className, { active: isActive }]} {...props}>
|
|
<slot />
|
|
</a>
|
|
<style>
|
|
a {
|
|
display: inline-block;
|
|
text-decoration: none;
|
|
}
|
|
a.active {
|
|
font-weight: bolder;
|
|
text-decoration: underline;
|
|
}
|
|
</style>
|