feat: kanporako link-ak ezberdintzen ditu
This commit is contained in:
1 parent
ecdbecae3f
commit
6d297f7cbe
3 files changed
+29
-11
No files matched your search
@@ -14,8 +14,12 @@ import { SITE_TITLE, SITE_DESCRIPTION } from "../config";
|
||||
<nav>
|
||||
<HeaderLink href="/">hasiera</HeaderLink>
|
||||
<HeaderLink href="/post">postak</HeaderLink>
|
||||
<HeaderLink href="https://sayagata.txarli.dev">sayagata</HeaderLink>
|
||||
<HeaderLink href="https://mastodon.eus/@txarli" rel="me">mastodon</HeaderLink>
|
||||
<HeaderLink isExternal href="https://sayagata.txarli.dev">sayagata</HeaderLink
|
||||
>
|
||||
<HeaderLink isExternal href="https://git.fosil.eu/txarli">git</HeaderLink>
|
||||
<HeaderLink isExternal href="https://mastodon.eus/@txarli" rel="me"
|
||||
>mastodon</HeaderLink
|
||||
>
|
||||
</nav>
|
||||
<style>
|
||||
h2 {
|
||||
|
||||
@@ -1,23 +1,28 @@
|
||||
---
|
||||
const { href, class: className, ...props } = Astro.props;
|
||||
let isActive: boolean;
|
||||
import ExternalIcon from "./assets/external.svg";
|
||||
|
||||
if (href === "/") {
|
||||
isActive = Astro.url.pathname === href;
|
||||
} else {
|
||||
isActive = Astro.url.pathname.startsWith(href);
|
||||
}
|
||||
const { href, isExternal, class: className, ...props } = Astro.props;
|
||||
|
||||
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 />
|
||||
{isExternal && <ExternalIcon />}
|
||||
</a>
|
||||
|
||||
<style>
|
||||
a {
|
||||
display: inline-block;
|
||||
display: inline-flex;
|
||||
text-decoration: none;
|
||||
align-items: center;
|
||||
}
|
||||
a.active {
|
||||
font-weight: bolder;
|
||||
@@ -25,4 +30,8 @@ if (href === "/") {
|
||||
text-decoration-thickness: 0.3ex;
|
||||
text-underline-offset: 0.3ex;
|
||||
}
|
||||
|
||||
a.external {
|
||||
font-style: italic;
|
||||
}
|
||||
</style>
|
||||
@@ -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 |
Reference in new issue
Block a user