2021-08-02 09:53:08 +02:00
|
|
|
<script lang="ts">
|
|
|
|
import { page } from '$app/stores'
|
2021-03-06 23:10:17 +01:00
|
|
|
|
2021-08-02 09:53:08 +02:00
|
|
|
import Icon from './Icon.svelte'
|
2020-07-24 11:10:01 +02:00
|
|
|
|
|
|
|
const routes = [
|
|
|
|
{ name: 'About', href: '/about' },
|
|
|
|
{ name: 'Works', href: '/works' },
|
|
|
|
{ name: 'Projects', href: '/projects' },
|
2020-09-23 15:37:12 +02:00
|
|
|
{ name: 'Blog', href: '/blog' },
|
2020-07-24 11:10:01 +02:00
|
|
|
{ name: 'Contact', href: '/contact' },
|
|
|
|
]
|
2020-09-22 21:47:33 +02:00
|
|
|
|
2021-08-02 09:53:08 +02:00
|
|
|
let nav: HTMLDivElement
|
2020-07-23 20:30:57 +02:00
|
|
|
</script>
|
|
|
|
|
2021-03-06 23:10:17 +01:00
|
|
|
<nav bind:this={nav}>
|
|
|
|
<a href="/">
|
2021-08-02 09:53:08 +02:00
|
|
|
<h1 class:active={$page.path === '/'}>NB</h1>
|
2021-03-06 23:10:17 +01:00
|
|
|
</a>
|
|
|
|
<ul>
|
|
|
|
<li>
|
|
|
|
<a href="/search">
|
|
|
|
<Icon icon="search-outline" />
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
{#each routes as { name, href }}
|
|
|
|
<li>
|
|
|
|
<a {href}>
|
|
|
|
<span>{name}</span>
|
2021-08-02 09:53:08 +02:00
|
|
|
<div class:active={$page.path.startsWith(href)} />
|
2021-03-06 23:10:17 +01:00
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
{/each}
|
|
|
|
</ul>
|
|
|
|
</nav>
|
|
|
|
|
2020-07-23 20:30:57 +02:00
|
|
|
<style>
|
2020-09-28 15:24:50 +02:00
|
|
|
nav :global(*) {
|
|
|
|
box-sizing: initial;
|
|
|
|
}
|
|
|
|
|
2020-07-24 11:10:01 +02:00
|
|
|
nav {
|
2020-09-22 21:47:33 +02:00
|
|
|
padding-top: env(safe-area-inset-top);
|
|
|
|
padding-bottom: env(safe-area-inset-bottom);
|
2020-09-28 15:24:50 +02:00
|
|
|
width: 3em;
|
2020-09-28 16:17:53 +02:00
|
|
|
height: 100%;
|
2020-07-24 11:10:01 +02:00
|
|
|
background-color: var(--clr-primary);
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
justify-content: space-between;
|
|
|
|
align-items: center;
|
2020-09-28 15:24:50 +02:00
|
|
|
border-right: 0.1em solid var(--clr-secondary);
|
2020-07-24 11:10:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
ul {
|
|
|
|
list-style: none;
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
2020-12-29 20:46:19 +01:00
|
|
|
max-height: 100%;
|
|
|
|
overflow: auto;
|
2020-07-24 11:10:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
a {
|
|
|
|
writing-mode: vertical-rl;
|
|
|
|
padding: 1em;
|
|
|
|
text-decoration: none;
|
|
|
|
}
|
|
|
|
|
2020-07-24 14:51:54 +02:00
|
|
|
li a {
|
|
|
|
line-height: 1em;
|
|
|
|
width: 1em;
|
2020-09-22 21:47:33 +02:00
|
|
|
position: relative;
|
|
|
|
}
|
|
|
|
|
|
|
|
li a span {
|
|
|
|
z-index: 5;
|
|
|
|
position: relative;
|
|
|
|
}
|
|
|
|
|
|
|
|
li a div {
|
|
|
|
z-index: 4;
|
|
|
|
width: 0.125em;
|
|
|
|
height: 100%;
|
|
|
|
top: 0;
|
|
|
|
left: 1.12em;
|
|
|
|
position: absolute;
|
2020-11-06 21:38:36 +01:00
|
|
|
transition: all 500ms ease;
|
2020-09-22 21:47:33 +02:00
|
|
|
}
|
|
|
|
li a div.active {
|
|
|
|
background-color: var(--clr-secondary);
|
2020-07-24 14:51:54 +02:00
|
|
|
}
|
2020-11-06 21:38:36 +01:00
|
|
|
li:hover a div:not(.active) {
|
|
|
|
background-color: var(--clr-light);
|
|
|
|
}
|
2020-07-24 14:51:54 +02:00
|
|
|
|
2020-07-24 11:10:01 +02:00
|
|
|
h1 {
|
|
|
|
margin: 0;
|
|
|
|
writing-mode: horizontal-tb;
|
|
|
|
letter-spacing: -0.15em;
|
|
|
|
width: 1.15em;
|
|
|
|
font-size: 1.5em;
|
|
|
|
}
|
|
|
|
|
2020-09-22 21:47:33 +02:00
|
|
|
h1.active {
|
|
|
|
box-shadow: 0 0.1em var(--clr-secondary);
|
|
|
|
}
|
|
|
|
|
2020-07-24 11:10:01 +02:00
|
|
|
@media (max-width: 30em) {
|
2020-09-22 21:47:33 +02:00
|
|
|
nav {
|
|
|
|
width: 2.5em;
|
|
|
|
}
|
|
|
|
|
2020-07-24 11:10:01 +02:00
|
|
|
a {
|
|
|
|
padding: 0.5em;
|
|
|
|
}
|
2020-09-22 21:47:33 +02:00
|
|
|
|
|
|
|
li a div {
|
|
|
|
transform: translateX(-0.5em);
|
|
|
|
}
|
2020-07-24 11:10:01 +02:00
|
|
|
}
|
2020-07-23 20:30:57 +02:00
|
|
|
</style>
|