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
+29 -11

No files matched your search

+6 -2
View File
@@ -14,8 +14,12 @@ import { SITE_TITLE, SITE_DESCRIPTION } from "../config";
<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 {
+18 -9
View File
@@ -1,23 +1,28 @@
--- ---
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
href={href}
class:list={[className, { active: isActive, external: isExternal }]}
{...props}
>
<slot /> <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 { a.active {
font-weight: bolder; font-weight: bolder;
@@ -25,4 +30,8 @@ if (href === "/") {
text-decoration-thickness: 0.3ex; text-decoration-thickness: 0.3ex;
text-underline-offset: 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