summaryrefslogtreecommitdiff
path: root/examples/blog/src/components/HeaderLink.astro
blob: 41e19de844f9815f9cd4ec1f1a31348965ec0db4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
---
export interface Props extends astroHTML.JSX.AnchorHTMLAttributes {}

const { href, class: className, ...props } = Astro.props as Props;
const isActive = href === Astro.url.pathname;
---

<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>