veikko.lintujarvi.fi/src/lib/header/Header.svelte
2022-03-20 11:27:36 +02:00

89 lines
1.6 KiB
Svelte

<script lang="ts">
import { page } from '$app/stores';
</script>
<header>
<div class="corner" />
<nav>
<ul>
<li class:active={$page.url.pathname === '/'}><a sveltekit:prefetch href="/">About</a></li>
<li class:active={$page.url.pathname === '/projects'}>
<a sveltekit:prefetch href="/projects">Projects</a>
</li>
<li class:active={$page.url.pathname === '/contact'}>
<a sveltekit:prefetch href="/contact">contact</a>
</li>
</ul>
</nav>
<div class="corner"/>
</header>
<style>
header {
display: flex;
justify-content: space-between;
}
.corner {
width: 3em;
height: 3em;
}
nav {
display: flex;
justify-content: center;
--background: rgba(42, 18, 128, 0.63);
}
ul {
position: relative;
border-radius: 0px 0px 20px 20px;
padding: 0;
margin: 0;
padding-left: 0.2em;
height: 3em;
display: flex;
justify-content: center;
align-items: center;
list-style: none;
background: var(--background);
background-size: contain;
}
li {
position: relative;
height: 100%;
}
li.active::before {
--size: 6px;
content: '';
width: 0;
height: 0;
position: absolute;
top: 0;
left: calc(50% - var(--size));
border: var(--size) solid transparent;
border-top: var(--size) solid var(--accent-color);
}
nav a {
display: flex;
height: 100%;
align-items: center;
padding: 0 1em;
color: var(--heading-color);
font-weight: 700;
font-size: 0.9rem;
text-transform: uppercase;
letter-spacing: 0.1em;
text-decoration: none;
transition: color 0.2s linear;
}
a:hover {
color: var(--accent-color);
}
</style>