Initial commit
This commit is contained in:
commit
b3a42bb0c8
91 changed files with 9419 additions and 0 deletions
14
src/components/NavLink.astro
Normal file
14
src/components/NavLink.astro
Normal file
|
@ -0,0 +1,14 @@
|
|||
---
|
||||
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(/\/$/, '');
|
||||
---
|
||||
|
||||
<a class:list={[className, { 'underline underline-offset-2 decoration-1': isActive }]} href={href} {...props}>
|
||||
<slot />
|
||||
</a>
|
Loading…
Add table
Add a link
Reference in a new issue