traxxx/assets/components/header/header.vue

372 lines
5.8 KiB
Vue

<template>
<header class="header">
<div class="header-nav">
<router-link
to="/"
class="logo-link"
><h1 class="header-logo">
<div
class="logo"
v-html="logo"
/>
</h1></router-link>
<nav class="nav">
<ul class="nav-list nolist">
<li class="nav-item">
<router-link
v-slot="{ href, isActive, navigate }"
to="/actors"
custom
>
<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="/channels"
custom
>
<a
class="nav-link"
:href="href"
:class="{ active: isActive }"
@click="navigate"
>Channels</a>
</router-link>
</li>
<li class="nav-item">
<router-link
v-slot="{ href, isActive, navigate }"
to="/tags"
custom
>
<a
class="nav-link"
:href="href"
:class="{ active: isActive }"
@click="navigate"
>Tags</a>
</router-link>
</li>
<li class="nav-item">
<router-link
v-slot="{ href, isActive, navigate }"
to="/movies"
custom
>
<a
class="nav-link"
:href="href"
:class="{ active: isActive }"
@click="navigate"
>Movies</a>
</router-link>
</li>
</ul>
</nav>
</div>
<div class="header-section">
<div
class="sidebar-toggle noselect"
@click.stop="$emit('toggleSidebar')"
><Icon icon="menu" /></div>
<Tooltip>
<div class="header-account">
<div class="account">
<Icon
icon="user3-long"
class="avatar"
/>
</div>
</div>
<template v-slot:tooltip>
<Menu />
</template>
</Tooltip>
<Search class="search-full" />
<Tooltip
class="search-compact"
:open="searching"
@open="searching = true"
@close="searching = false"
>
<button
type="button"
class="search-button"
><Icon
icon="search"
/></button>
<template v-slot:tooltip>
<Search
:searching="searching"
class="compact"
@search="searching = false"
@click.stop
/>
</template>
</Tooltip>
</div>
</header>
</template>
<script>
import Menu from './menu.vue';
import Search from './search.vue';
import logo from '../../img/logo.svg';
export default {
components: {
Menu,
Search,
},
emits: ['toggleSidebar', 'showFilters'],
data() {
return {
logo,
searching: false,
showFilters: false,
};
},
};
</script>
<style lang="scss" scoped>
@import 'breakpoints';
.header {
height: 3rem;
display: flex;
align-items: center;
z-index: 2;
justify-content: space-between;
background: var(--background);
color: var(--primary);
box-shadow: 0 0 3px var(--darken-weak);
font-size: 0;
}
.header-nav {
display: flex;
align-items: center;
height: 100%;
overflow: hidden;
}
.header-section {
height: 100%;
align-items: center;
display: flex;
flex-direction: row;
}
.sidebar-toggle {
display: none;
align-items: center;
height: 100%;
.icon {
display: inline-block;
fill: var(--shadow-modest);
padding: 0 1rem;
width: 1.5rem;
height: 100%;
}
&:hover {
cursor: pointer;
.icon {
fill: var(--primary);
}
}
}
.logo-link {
height: 100%;
display: inline-block;
text-decoration: none;
margin: -.25rem 1rem 0 0;
}
.header-logo {
height: 100%;
display: flex;
align-items: center;
padding: 0 0 0 1rem;
fill: var(--primary);
}
.logo {
width: 6rem;
display: flex;
}
.nav,
.nav-list {
display: inline-block;
height: 100%;
}
.nav-item {
height: 100%;
}
.nav-link {
height: 100%;
display: flex;
align-items: center;
justify-content: center;
padding: 0 1rem;
color: var(--shadow);
text-decoration: none;
font-size: .9rem;
font-weight: bold;
cursor: pointer;
&.active {
color: var(--primary);
.icon {
fill: var(--primary);
}
}
&:hover:not(.active) {
color: var(--primary);
.icon {
fill: var(--primary);
}
}
}
.header-toggles {
margin: 0 .5rem 0 0;
.icon {
padding: 1rem .75rem;
fill: var(--shadow);
&:hover {
fill: var(--shadow-strong);
cursor: pointer;
}
&.active {
fill: var(--primary);
}
}
}
.header-account {
padding: 1rem;
&:hover {
cursor: pointer;
.account {
border-color: var(--primary);
}
.avatar {
fill: var(--primary);
}
}
}
.account {
width: 1.25rem;
height: 1.25rem;
display: flex;
justify-content: center;
border: solid 2px var(--shadow);
border-radius: 1.5rem;
overflow: hidden;
.avatar {
width: 1rem;
height: 1rem;
margin: .3rem 0 0 0;
fill: var(--shadow);
}
}
.search-compact {
display: none;
height: 100%;
}
.search-button {
height: 100%;
padding: .25rem 1rem 0 1rem;
background: none;
border: none;
outline: none;
.icon {
fill: var(--shadow);
}
&:hover {
cursor: pointer;
.icon {
fill: var(--shadow-strong);
}
}
}
@media(max-width: $breakpoint-kilo) {
.search-full {
display: none;
}
.search-compact {
display: flex;
}
.header-account {
padding: 1rem .5rem 1rem 1rem;
}
}
@media(max-width: $breakpoint-small) {
.sidebar-toggle {
display: flex;
}
.logo-link {
margin: -.25rem 1.25rem 0 0;
}
.nav-link {
padding: 0.05rem .75rem 0 .75rem;
}
.search-compact {
display: none;
}
.header-account {
display: none;
}
}
</style>