diff options
author | Jakob Stendahl <jakobste@uio.no> | 2020-10-13 20:28:52 +0200 |
---|---|---|
committer | Jakob Stendahl <jakobste@uio.no> | 2020-10-13 20:28:52 +0200 |
commit | e53bddfc71d70eb9f2b7a2910b4b191bc43088ab (patch) | |
tree | 6074f957be167995845588352ce4108b9759fa00 /src/components/Nav.svelte | |
download | Aurora-data-e53bddfc71d70eb9f2b7a2910b4b191bc43088ab.tar.gz Aurora-data-e53bddfc71d70eb9f2b7a2910b4b191bc43088ab.zip |
First commit
Diffstat (limited to 'src/components/Nav.svelte')
-rw-r--r-- | src/components/Nav.svelte | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/src/components/Nav.svelte b/src/components/Nav.svelte new file mode 100644 index 0000000..3240ecf --- /dev/null +++ b/src/components/Nav.svelte @@ -0,0 +1,60 @@ +<script lang="ts"> + export let segment: string; +</script> + +<style> + nav { + border-bottom: 1px solid rgba(255,62,0,0.1); + font-weight: 300; + padding: 0 1em; + } + + ul { + margin: 0; + padding: 0; + } + + /* clearfix */ + ul::after { + content: ''; + display: block; + clear: both; + } + + li { + display: block; + float: left; + } + + [aria-current] { + position: relative; + display: inline-block; + } + + [aria-current]::after { + position: absolute; + content: ''; + width: calc(100% - 1em); + height: 2px; + background-color: rgb(255,62,0); + display: block; + bottom: -1px; + } + + a { + text-decoration: none; + padding: 1em 0.5em; + display: block; + } +</style> + +<nav> + <ul> + <li><a aria-current="{segment === undefined ? 'page' : undefined}" href=".">home</a></li> + <li><a aria-current="{segment === 'about' ? 'page' : undefined}" href="about">about</a></li> + + <!-- for the blog link, we're using rel=prefetch so that Sapper prefetches + the blog data when we hover over the link or tap it on a touchscreen --> + <li><a rel=prefetch aria-current="{segment === 'blog' ? 'page' : undefined}" href="blog">blog</a></li> + </ul> +</nav> |