summaryrefslogtreecommitdiff
path: root/src/components/organisms/ActiveLink.astro
diff options
context:
space:
mode:
authorJoão Augusto Costa Branco Marado Torres <torres.dev@disroot.org>2025-06-28 18:14:22 -0300
committerJoão Augusto Costa Branco Marado Torres <torres.dev@disroot.org>2025-06-28 18:14:22 -0300
commit79fd506d30eef3d113f4a8e3ab9ebd9004f1e8cc (patch)
tree96ff57c92e897c3cc3331e23043d20f1665c7d0a /src/components/organisms/ActiveLink.astro
parenta1eac976b20e39f86d5944fbec68e2a0f8ffb746 (diff)
feat: index page
Signed-off-by: João Augusto Costa Branco Marado Torres <torres.dev@disroot.org>
Diffstat (limited to 'src/components/organisms/ActiveLink.astro')
-rw-r--r--src/components/organisms/ActiveLink.astro18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/components/organisms/ActiveLink.astro b/src/components/organisms/ActiveLink.astro
new file mode 100644
index 0000000..8c01f92
--- /dev/null
+++ b/src/components/organisms/ActiveLink.astro
@@ -0,0 +1,18 @@
+---
+import type { HTMLAttributes } from "astro/types";
+
+type Props = HTMLAttributes<"a">;
+
+const { href, class: className, ...props } = Astro.props;
+const pathname = Astro.url.pathname;
+const isActive = href === pathname;
+---
+
+<a {href} class:list={[className, { current: isActive }]} {...props}>
+ <slot />
+</a>
+<style>
+ a.current {
+ font-weight: bolder;
+ }
+</style>