simple nav

This commit is contained in:
Daniel Vinci 2021-04-30 13:33:32 -06:00
parent 9caab461a0
commit 26f742d870
No known key found for this signature in database
GPG key ID: 7A700C29916C26CA
2 changed files with 46 additions and 3 deletions

View file

@ -1,7 +1,28 @@
<script>
export let segment
import NavItem from "./NavItem.svelte";
export let segment;
const titlesMap = {
undefined: "home",
"free-open-source": "free & open source",
"about-contact": "about & contact",
faq: "faq",
"global-open-infrastructure": "global open infrastructure",
"privacy-by-design": "privacy by design",
};
</script>
<nav>
<NavItem {segment} href="." matchingSegment={undefined} humanName="home" />
<NavItem
{segment}
href="./about-contact"
matchingSegment="about-contact"
humanName="about & contact"
/>
</nav>
<style>
nav {
font-weight: 300;
@ -14,5 +35,3 @@
align-items: center;
}
</style>
<nav>{segment}</nav>

View file

@ -0,0 +1,24 @@
<script>
export let segment;
export let humanName;
export let href;
export let matchingSegment;
</script>
<div
class="navItem"
aria-current={segment === matchingSegment ? "page" : undefined}
>
<a rel="prefetch" {href}>{humanName}</a>
</div>
<style>
.navItem {
height: 100%;
display: flex;
justify-content: center;
align-items: center;
padding-left: 0.5em;
padding-right: 0.5em;
}
</style>