Added this website as content to hobbies, refactored some items into site-layout
All checks were successful
Build and Test - Staging / test (pull_request) Successful in 5m6s
Build and Test - Staging / build_and_push (pull_request) Successful in 5m14s
Build and Test - Staging / deploy_staging (pull_request) Successful in 3s

This commit is contained in:
2025-12-10 16:59:54 -08:00
parent 25c08f7a1d
commit 649b596c7c
9 changed files with 171 additions and 29 deletions

View File

@@ -1,20 +1,12 @@
---
import type { navLink } from "@interfaces/site-layout.ts";
import { getHrefPath, getNavLinkSuffix } from "@data/site-layout.ts";
const items: navLink[] = Astro.props.items;
const depth: number = Astro.props.depth ?? 0;
const paths: string[] = Astro.props.paths ?? [];
const getNavLinkSuffix = (entry: navLink): string => {
return "-" + [...paths, entry.path].join("-");
};
const getHrefPath = (entry: navLink): string => {
return entry.pubpath
? entry.pubpath
: "/" +
(paths && paths.length ? [...paths, entry.path].join("/") : entry.path);
};
const { pathname } = Astro.url;
---
@@ -29,21 +21,22 @@ const { pathname } = Astro.url;
{
items.map(
(entry) =>
(entry.enabled ?? true) && (
(entry.enabled ?? true) &&
!(entry.hidden ?? false) && (
<li class="">
{Array.isArray(entry.children) && entry.children.length ? (
<div>
<button
id={"dropdownNavbarLink" + getNavLinkSuffix(entry)}
id={"dropdownNavbarLink" + getNavLinkSuffix(paths, entry)}
data-dropdown-toggle={
"dropdownNavbar" + getNavLinkSuffix(entry)
"dropdownNavbar" + getNavLinkSuffix(paths, entry)
}
data-dropdown-placement="bottom-start"
data-dropdown-offset-distance="5"
data-dropdown-offset-skidding="12"
class:list={[
"hover:text-caperren-green-light lg:hover:text-caperren-green-light flex w-full items-center justify-between lg:p-0 lg:hover:bg-transparent",
pathname.startsWith(getHrefPath(entry))
pathname.startsWith(getHrefPath(paths, entry))
? "border-caperren-green border-b-2"
: false,
]}
@@ -65,7 +58,7 @@ const { pathname } = Astro.url;
</svg>
</button>
<div
id={"dropdownNavbar" + getNavLinkSuffix(entry)}
id={"dropdownNavbar" + getNavLinkSuffix(paths, entry)}
class="border-caperren-green z-10 hidden w-max max-w-screen border bg-black px-6 shadow-sm"
>
<Astro.self
@@ -78,16 +71,18 @@ const { pathname } = Astro.url;
) : (
<div>
<a
href={getHrefPath(entry)}
target={getHrefPath(entry).startsWith("/") ? "" : "_blank"}
href={getHrefPath(paths, entry)}
target={
getHrefPath(paths, entry).startsWith("/") ? "" : "_blank"
}
class:list={[
"hover:text-caperren-green-light ring-caperren-green-dark block bg-transparent lg:p-0",
pathname === getHrefPath(entry)
pathname === getHrefPath(paths, entry)
? "border-caperren-green border-b-2"
: false,
]}
aria-current={
pathname === getHrefPath(entry) ? "page" : undefined
pathname === getHrefPath(paths, entry) ? "page" : undefined
}
>
{entry.navText}