feat: kanporako link-ak ezberdintzen ditu

This commit is contained in:
txarli committed 2026-11-19 18:54:25 +01:00
1 parent ecdbecae3f
commit 6d297f7cbe
3 files changed
+50 -32

No files matched your search

+17 -13
View File
@@ -4,21 +4,25 @@ import { SITE_TITLE, SITE_DESCRIPTION } from "../config";
--- ---
<header> <header>
<div class="header-section"> <div class="header-section">
<div class="header-frame"> <div class="header-frame">
<h1>{SITE_TITLE}</h1> <h1>{SITE_TITLE}</h1>
<h2>{SITE_DESCRIPTION}</h2> <h2>{SITE_DESCRIPTION}</h2>
</div> </div>
</div> </div>
</header> </header>
<nav> <nav>
<HeaderLink href="/">hasiera</HeaderLink> <HeaderLink href="/">hasiera</HeaderLink>
<HeaderLink href="/post">postak</HeaderLink> <HeaderLink href="/post">postak</HeaderLink>
<HeaderLink href="https://sayagata.txarli.dev">sayagata</HeaderLink> <HeaderLink isExternal href="https://sayagata.txarli.dev">sayagata</HeaderLink
<HeaderLink href="https://mastodon.eus/@txarli" rel="me">mastodon</HeaderLink> >
<HeaderLink isExternal href="https://git.fosil.eu/txarli">git</HeaderLink>
<HeaderLink isExternal href="https://mastodon.eus/@txarli" rel="me"
>mastodon</HeaderLink
>
</nav> </nav>
<style> <style>
h2 { h2 {
margin: 0.5em 0; margin: 0.5em 0;
} }
</style> </style>
+28 -19
View File
@@ -1,28 +1,37 @@
--- ---
const { href, class: className, ...props } = Astro.props; import ExternalIcon from "./assets/external.svg";
let isActive: boolean;
if (href === "/") { const { href, isExternal, class: className, ...props } = Astro.props;
isActive = Astro.url.pathname === href;
} else {
isActive = Astro.url.pathname.startsWith(href);
}
const isActive =
href === "/"
? Astro.url.pathname === href
: Astro.url.pathname.startsWith(href);
--- ---
<a href={href} class:list={[className, { active: isActive }]} {...props}> <a
<slot /> href={href}
class:list={[className, { active: isActive, external: isExternal }]}
{...props}
>
<slot />
{isExternal && <ExternalIcon />}
</a> </a>
<style> <style>
a { a {
display: inline-block; display: inline-flex;
text-decoration: none; text-decoration: none;
} align-items: center;
a.active { }
font-weight: bolder; a.active {
text-decoration: underline; font-weight: bolder;
text-decoration-thickness: 0.3ex; text-decoration: underline;
text-underline-offset: 0.3ex; text-decoration-thickness: 0.3ex;
} text-underline-offset: 0.3ex;
}
a.external {
font-style: italic;
}
</style> </style>
+5
View File
@@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
<path d="M0 0h24v24H0z" fill="none" />
<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M10 5H8.2c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C5 6.52 5 7.08 5 8.2v7.6c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874c.427.218.987.218 2.105.218h7.606c1.118 0 1.677 0 2.104-.218c.377-.192.683-.498.875-.874c.218-.428.218-.987.218-2.105V14m1-5V4m0 0h-5m5 0l-7 7" />
</svg>

After

Width:  |  Height:  |  Size: 521 B