traxxx/assets/components/sidebar/sidebar.vue

213 lines
4.9 KiB
Vue

<template>
<div
class="sidebar"
@click.stop
>
<div class="sidebar-header">
<Icon
icon="cross2"
class="sidebar-close"
@click.native="toggleSidebar(false)"
/>
<router-link
to="/home"
class="logo-link"
@click.native="toggleSidebar(false)"
>
<h1 class="sidebar-logo">
<div
class="logo logo-primary"
v-html="logoPrimary"
/>
<div
class="logo logo-light"
v-html="logoLight"
/>
</h1>
</router-link>
</div>
<nav class="nav">
<ul class="nolist">
<li class="nav-item">
<router-link
v-slot="{ href, isActive, navigate }"
to="/home"
@click.native="toggleSidebar(false)"
>
<a
class="nav-link"
:href="href"
:class="{ active: isActive }"
@click="navigate"
>Home</a>
</router-link>
</li>
<li class="nav-item">
<router-link
v-slot="{ href, isActive, navigate }"
to="/actors"
@click.native="toggleSidebar(false)"
>
<a
class="nav-link"
:href="href"
:class="{ active: isActive }"
@click="navigate"
>Actors</a>
</router-link>
</li>
<li class="nav-item">
<router-link
v-slot="{ href, isActive, navigate }"
to="/networks"
@click.native="toggleSidebar(false)"
>
<a
class="nav-link"
:href="href"
:class="{ active: isActive }"
@click="navigate"
>Sites</a>
</router-link>
</li>
<li class="nav-item">
<router-link
v-slot="{ href, isActive, navigate }"
to="/tags"
@click.native="toggleSidebar(false)"
>
<a
class="nav-link"
:href="href"
:class="{ active: isActive }"
@click="navigate"
>Tags</a>
</router-link>
</li>
</ul>
</nav>
</div>
</template>
<script>
import logoPrimary from '../../img/logo.svg';
import logoLight from '../../img/logo-light.svg';
export default {
props: {
toggleSidebar: {
type: Function,
default: null,
},
},
data() {
return {
logoPrimary,
logoLight,
};
},
};
</script>
<style lang="scss" scoped>
.sidebar {
display: flex;
flex-direction: column;
width: 15rem;
height: 100%;
position: absolute;
z-index: 10;
color: var(--text-light);
background: var(--primary);
box-shadow: 0 0 3px var(--darken);
}
.sidebar-header {
display: flex;
justify-content: space-between;
height: 3rem;
border-bottom: solid 1px var(--shadow-hint);
margin: 0 0 .5rem 0;
}
.sidebar-close {
width: 1.5rem;
height: 100%;
padding: 0 1rem;
fill: var(--lighten);
&:hover {
fill: var(--text-light);
cursor: pointer;
}
}
.sidebar-logo {
height: 100%;
display: flex;
align-items: center;
margin: 0;
}
.logo-link {
display: block;
height: 100%;
padding: 0 1rem;
}
.logo {
width: 6rem;
display: flex;
align-items: center;
margin: 0;
}
.logo-primary {
display: none;
}
.nav-item {
display: block;
}
.nav-link {
color: var(--lighten-strong);
display: block;
padding: 1rem;
text-decoration: none;
font-weight: bold;
&:hover,
&.active {
background: var(--shadow-hint);
}
&.active {
color: var(--text-light);
}
}
.dark .sidebar {
background: var(--profile);
.nav-link.active {
color: var(--primary);
background: var(--shadow-hint);
}
.logo-primary {
display: flex;
}
.logo-light {
display: none;
}
}
</style>