14 lines
359 B
Plaintext
14 lines
359 B
Plaintext
---
|
|
const { pathname } = Astro.url;
|
|
const { class: className = '', href, ...props } = Astro.props;
|
|
const isActive =
|
|
href === pathname || href === (pathname.endsWith('/') ? pathname.slice(0, -1) : pathname);
|
|
---
|
|
|
|
<a
|
|
href={href}
|
|
class={`inline-block ${className} ${isActive ? 'font-bold underline' : 'font-medium no-underline'}`}
|
|
{...props}>
|
|
<slot />
|
|
</a>
|