fix(header): update style
This commit is contained in:
parent
388c9f2e8b
commit
8d2285c735
@ -69,7 +69,7 @@ const navLinks = [
|
|||||||
navLinks.map(({ href, label }) => (
|
navLinks.map(({ href, label }) => (
|
||||||
<HeaderLink
|
<HeaderLink
|
||||||
href={href}
|
href={href}
|
||||||
class="block w-full rounded-lg px-4 py-2 text-center font-sans text-sm font-medium leading-normal text-zinc-900 antialiased transition-all hover:bg-zinc-50 dark:text-zinc-100 dark:hover:bg-zinc-950 md:text-xl">
|
class="block w-full rounded-lg px-4 py-2 text-center font-sans text-sm leading-normal text-zinc-900 antialiased transition-all hover:bg-zinc-50 dark:text-zinc-100 dark:hover:bg-zinc-950 md:text-xl">
|
||||||
{label}
|
{label}
|
||||||
</HeaderLink>
|
</HeaderLink>
|
||||||
))
|
))
|
||||||
|
|||||||
@ -1,20 +1,13 @@
|
|||||||
---
|
---
|
||||||
const { pathname } = Astro.url;
|
const { pathname } = Astro.url;
|
||||||
const { class: className, href, ...props } = Astro.props;
|
const { class: className = '', href, ...props } = Astro.props;
|
||||||
const isActive = href === pathname || href === pathname.replace(/\/$/, '');
|
const isActive =
|
||||||
|
href === pathname || href === (pathname.endsWith('/') ? pathname.slice(0, -1) : pathname);
|
||||||
---
|
---
|
||||||
|
|
||||||
<a href={href} class:list={[className, { active: isActive }]} {...props}>
|
<a
|
||||||
|
href={href}
|
||||||
|
class={`inline-block ${className} ${isActive ? 'font-bold underline' : 'font-medium no-underline'}`}
|
||||||
|
{...props}>
|
||||||
<slot />
|
<slot />
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<style>
|
|
||||||
a {
|
|
||||||
display: inline-block;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
a.active {
|
|
||||||
font-weight: bolder;
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user