Started refactoring, added prettier and checks and reformatted project, added cspell and checks and custom project words, beginning of robotic oceanographic surface sampler content
This commit is contained in:
@@ -1,51 +1,78 @@
|
||||
---
|
||||
import type {navLink} from "@interfaces/site-layout.ts";
|
||||
import type { navLink } from "@interfaces/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("-")
|
||||
}
|
||||
return "-" + [...paths, entry.path].join("-");
|
||||
};
|
||||
const getHrefPath = (entry: navLink): string => {
|
||||
return entry.pubpath ? entry.pubpath : ("/" + (paths && paths.length ? [...paths, entry.path].join("/") : entry.path));
|
||||
}
|
||||
return entry.pubpath
|
||||
? entry.pubpath
|
||||
: "/" +
|
||||
(paths && paths.length ? [...paths, entry.path].join("/") : entry.path);
|
||||
};
|
||||
---
|
||||
<ul class={"flex flex-col p-4 bg-black border-caperren-green " + (depth ? "space-y-2" : "items-start lg:flex-row lg:space-x-8 lg:mt-0 ")}>
|
||||
{
|
||||
items.map((entry) => (
|
||||
(entry.enabled ?? true) && (
|
||||
<li>
|
||||
{Array.isArray(entry.children) && entry.children.length ? (
|
||||
<button id={"dropdownNavbarLink" + getNavLinkSuffix(entry)}
|
||||
data-dropdown-toggle={"dropdownNavbar" + getNavLinkSuffix(entry)}
|
||||
data-dropdown-placement="bottom"
|
||||
class="flex items-center justify-between py-2 px-3 w-full hover:text-caperren-green-light lg:hover:bg-transparent lg:border-0 lg:hover:text-caperren-green-light lg:p-0 ">
|
||||
{entry.navText}
|
||||
<svg class="w-2.5 h-2.5 ms-2.5" aria-hidden="true"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 10 6">
|
||||
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"
|
||||
stroke-width="2"
|
||||
d="m1 1 4 4 4-4"/>
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
<div id={"dropdownNavbar" + getNavLinkSuffix(entry)}
|
||||
class="z-10 hidden bg-black border border-caperren-green shadow-sm w-screen lg:w-max">
|
||||
<Astro.self items={entry.children} paths={[...paths, entry.path]}
|
||||
depth={depth + 1}/>
|
||||
</div>
|
||||
|
||||
) : (
|
||||
|
||||
<a href={getHrefPath(entry)}
|
||||
class="block py-2 px-3 bg-transparent hover:text-caperren-green-light ring-caperren-green-dark lg:p-0"
|
||||
aria-current="page">{entry.navText}</a>
|
||||
|
||||
)}
|
||||
</li>
|
||||
)
|
||||
))}
|
||||
</ul>
|
||||
<ul
|
||||
class={"flex flex-col p-4 bg-black border-caperren-green " +
|
||||
(depth ? "space-y-2" : "items-start lg:flex-row lg:space-x-8 lg:mt-0 ")}
|
||||
>
|
||||
{
|
||||
items.map(
|
||||
(entry) =>
|
||||
(entry.enabled ?? true) && (
|
||||
<li>
|
||||
{Array.isArray(entry.children) && entry.children.length ? (
|
||||
<div>
|
||||
<button
|
||||
id={"dropdownNavbarLink" + getNavLinkSuffix(entry)}
|
||||
data-dropdown-toggle={
|
||||
"dropdownNavbar" + getNavLinkSuffix(entry)
|
||||
}
|
||||
data-dropdown-placement="bottom"
|
||||
class="hover:text-caperren-green-light lg:hover:text-caperren-green-light flex w-full items-center justify-between px-3 py-2 lg:border-0 lg:p-0 lg:hover:bg-transparent"
|
||||
>
|
||||
{entry.navText}
|
||||
<svg
|
||||
class="ms-2.5 h-2.5 w-2.5"
|
||||
aria-hidden="true"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 10 6"
|
||||
>
|
||||
<path
|
||||
stroke="currentColor"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="2"
|
||||
d="m1 1 4 4 4-4"
|
||||
/>
|
||||
</svg>
|
||||
</button>
|
||||
<div
|
||||
id={"dropdownNavbar" + getNavLinkSuffix(entry)}
|
||||
class="border-caperren-green z-10 hidden w-screen border bg-black shadow-sm lg:w-max"
|
||||
>
|
||||
<Astro.self
|
||||
items={entry.children}
|
||||
paths={[...paths, entry.path]}
|
||||
depth={depth + 1}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<a
|
||||
href={getHrefPath(entry)}
|
||||
class="hover:text-caperren-green-light ring-caperren-green-dark block bg-transparent px-3 py-2 lg:p-0"
|
||||
aria-current="page"
|
||||
>
|
||||
{entry.navText}
|
||||
</a>
|
||||
)}
|
||||
</li>
|
||||
),
|
||||
)
|
||||
}
|
||||
</ul>
|
||||
|
||||
Reference in New Issue
Block a user