mirror of
https://github.com/kogakure/website-astro-stefanimhoff.de.git
synced 2026-02-03 20:15:27 +00:00
feat(astro): add navigation component
This commit is contained in:
28
src/components/MainNavigation.astro
Normal file
28
src/components/MainNavigation.astro
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
---
|
||||||
|
import navigation from '../data/navigation.json';
|
||||||
|
|
||||||
|
const currentPath = new URL(Astro.request.url).pathname;
|
||||||
|
---
|
||||||
|
|
||||||
|
<nav
|
||||||
|
class="navigation col-span-16 col-start-2 self-center md:col-span-14 md:col-start-3"
|
||||||
|
role="navigation"
|
||||||
|
>
|
||||||
|
<ul class="navigation-list flex flex-wrap">
|
||||||
|
{
|
||||||
|
navigation.map(({ title, url }) => (
|
||||||
|
<li class="navigation-list-item mie-[10px] xs:mie-[15px]">
|
||||||
|
<a
|
||||||
|
class={`navigation-item-link text-3 font-light decoration-4 underline-offset-auto hover:underline hover:decoration-shibui-900/20 dark:hover:decoration-shibui-100/20 ${
|
||||||
|
currentPath === url &&
|
||||||
|
'active underline !decoration-accent decoration-4'
|
||||||
|
}`}
|
||||||
|
href={url}
|
||||||
|
>
|
||||||
|
{title}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
18
src/data/navigation.json
Normal file
18
src/data/navigation.json
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"title": "Home",
|
||||||
|
"url": "/"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "About",
|
||||||
|
"url": "/about/"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Journal",
|
||||||
|
"url": "/journal/"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Projects",
|
||||||
|
"url": "/projects/"
|
||||||
|
}
|
||||||
|
]
|
||||||
Reference in New Issue
Block a user