mirror of
https://github.com/kevin-DL/sapper-template.git
synced 2026-01-12 10:25:16 +00:00
75 lines
1.4 KiB
HTML
75 lines
1.4 KiB
HTML
<nav>
|
|
<ul>
|
|
<li><a class='{segment === undefined ? "selected" : ""}' href='.'>home</a></li>
|
|
<li><a class='{segment === "about" ? "selected" : ""}' 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 class='{segment === "blog" ? "selected" : ""}' href='blog'>blog</a></li>
|
|
|
|
{#if $user}
|
|
<li><span on:click="logout()">sign out</span></li>
|
|
{:else}
|
|
<li><a class='{segment === "login" ? "selected" : ""}' href='login'>log in</a></li>
|
|
<li><a class='{segment === "signup" ? "selected" : ""}' href='signup'>sign up</a></li>
|
|
{/if}
|
|
|
|
</ul>
|
|
</nav>
|
|
|
|
<script>
|
|
export default {
|
|
methods: {
|
|
logout() {
|
|
this.store.get().logout()
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<style>
|
|
nav {
|
|
border-bottom: 1px solid rgba(170,30,30,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;
|
|
}
|
|
|
|
.selected {
|
|
position: relative;
|
|
display: inline-block;
|
|
}
|
|
|
|
.selected::after {
|
|
position: absolute;
|
|
content: '';
|
|
width: calc(100% - 1em);
|
|
height: 2px;
|
|
background-color: rgb(170,30,30);
|
|
display: block;
|
|
bottom: -1px;
|
|
}
|
|
|
|
a, span {
|
|
text-decoration: none;
|
|
padding: 1em 0.5em;
|
|
display: block;
|
|
cursor: pointer;
|
|
}
|
|
</style> |