Update links and colors

This commit is contained in:
Cassidy Williams committed 2023-11-08 10:06:19 -06:00
1 parent 466c198e82
commit fb86147f6a
3 files changed
+23 -10

No files matched your search

+1 -1
View File
@@ -7,7 +7,7 @@
function setRandomLinkColor() {
Array.from(document.getElementsByTagName("a")).forEach((e) => {
e.style.color = getRandomColor();
e.style.textDecorationColor = getRandomColor();
});
}
+7 -1
View File
@@ -2,7 +2,11 @@
export interface Props extends astroHTML.JSX.AnchorHTMLAttributes {}
const { href, class: className, ...props } = Astro.props as Props;
const isActive = href === Astro.url.pathname;
let isActive = href === Astro.url.pathname;
if (Astro.url.pathname.startsWith("/post/")) {
isActive = true;
}
---
<a href={href} class:list={[className, { active: isActive }]} {...props}>
@@ -16,5 +20,7 @@ const isActive = href === Astro.url.pathname;
a.active {
font-weight: bolder;
text-decoration: underline;
text-decoration-thickness: 0.3ex;
text-underline-offset: 0.3ex;
}
</style>