traxxx/assets/components/header/header.vue

492 lines
7.7 KiB
Vue
Raw Normal View History

<template>
2020-05-17 23:22:56 +00:00
<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
2020-05-17 23:22:56 +00:00
>
<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
2020-05-17 23:22:56 +00:00
>
<a
class="nav-link"
:href="href"
:class="{ active: isActive }"
@click="navigate"
2020-06-27 02:50:13 +00:00
>Channels</a>
2020-05-17 23:22:56 +00:00
</router-link>
</li>
2020-07-25 01:44:19 +00:00
<li class="nav-item">
<router-link
v-slot="{ href, isActive, navigate }"
to="/tags"
custom
2020-07-25 01:44:19 +00:00
>
<a
class="nav-link"
:href="href"
:class="{ active: isActive }"
@click="navigate"
>Tags</a>
2020-07-25 01:44:19 +00:00
</router-link>
</li>
2020-05-17 23:22:56 +00:00
<li class="nav-item">
<router-link
v-slot="{ href, isActive, navigate }"
to="/movies"
custom
2020-05-17 23:22:56 +00:00
>
<a
class="nav-link"
:href="href"
:class="{ active: isActive }"
@click="navigate"
>Movies</a>
2020-05-17 23:22:56 +00:00
</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>
2020-05-17 23:22:56 +00:00
<template v-slot:tooltip>
<div class="menu">
<ul class="menu-items noselect">
2020-12-27 03:21:10 +00:00
<li
class="menu-item disabled"
@click.stop
>
<Icon icon="enter2" />Sign in
</li>
<li
v-show="!sfw"
class="menu-item"
2020-12-27 03:21:10 +00:00
@click.stop="setSfw(true)"
>
<Icon
icon="flower"
class="toggle noselect"
/>Safe mode
</li>
<li
v-show="sfw"
class="menu-item"
2020-12-27 03:21:10 +00:00
@click.stop="setSfw(false)"
>
<Icon
icon="fire"
class="toggle noselect"
/>Filth mode
</li>
<li
v-show="theme === 'light'"
class="menu-item"
2020-12-27 03:21:10 +00:00
@click.stop="setTheme('dark')"
>
<Icon
icon="moon"
class="toggle noselect"
/>Dark theme
</li>
<li
v-show="theme === 'dark'"
class="menu-item"
2020-12-27 03:21:10 +00:00
@click.stop="setTheme('light')"
>
<Icon
icon="sun"
class="toggle noselect"
/>Light theme
</li>
2020-12-27 03:21:10 +00:00
<li
2021-01-03 21:53:51 +00:00
class="menu-item"
@click="$emit('showFilters', true)"
2020-12-27 03:21:10 +00:00
>
<Icon icon="filter" />Filters
</li>
</ul>
</div>
</template>
</Tooltip>
2020-05-17 23:22:56 +00:00
<Search class="search-full" />
<Tooltip
2020-05-17 23:22:56 +00:00
class="search-compact"
:open="searching"
@open="searching = true"
@close="searching = false"
2020-05-17 23:22:56 +00:00
>
<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>
2020-05-17 23:22:56 +00:00
</div>
</header>
</template>
2020-02-26 00:15:50 +00:00
<script>
2020-03-23 00:43:49 +00:00
import { mapState } from 'vuex';
import Search from './search.vue';
2020-02-26 00:15:50 +00:00
import logo from '../../img/logo.svg';
2020-03-23 00:43:49 +00:00
function sfw(state) {
2020-05-17 23:22:56 +00:00
return state.ui.sfw;
2020-03-23 00:43:49 +00:00
}
function theme(state) {
2020-05-17 23:22:56 +00:00
return state.ui.theme;
2020-03-23 00:43:49 +00:00
}
function setTheme(newTheme) {
2020-05-17 23:22:56 +00:00
this.$store.dispatch('setTheme', newTheme);
2020-03-23 00:43:49 +00:00
}
function setSfw(enabled) {
2020-05-17 23:22:56 +00:00
this.$store.dispatch('setSfw', enabled);
2020-03-23 00:43:49 +00:00
}
2020-02-26 00:15:50 +00:00
export default {
2020-05-17 23:22:56 +00:00
components: {
Search,
},
emits: ['toggleSidebar', 'showFilters'],
2020-05-17 23:22:56 +00:00
data() {
return {
logo,
searching: false,
2021-01-03 21:53:51 +00:00
showFilters: false,
2020-05-17 23:22:56 +00:00
};
},
computed: {
...mapState({
sfw,
theme,
}),
},
methods: {
setSfw,
setTheme,
},
2020-02-26 00:15:50 +00:00
};
</script>
<style lang="scss" scoped>
2020-07-05 02:40:57 +00:00
@import 'breakpoints';
.header {
height: 3rem;
display: flex;
align-items: center;
2020-05-25 00:02:28 +00:00
z-index: 2;
2020-02-26 00:15:50 +00:00
justify-content: space-between;
2020-03-23 00:43:49 +00:00
background: var(--background);
color: var(--primary);
2020-05-25 00:02:28 +00:00
box-shadow: 0 0 3px var(--darken-weak);
font-size: 0;
}
2020-03-08 03:31:19 +00:00
.header-nav {
display: flex;
align-items: center;
height: 100%;
overflow: hidden;
2020-03-08 03:31:19 +00:00
}
2020-03-23 00:43:49 +00:00
.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;
2020-05-25 00:02:28 +00:00
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;
2020-03-23 00:43:49 +00:00
color: var(--shadow);
text-decoration: none;
font-size: .9rem;
font-weight: bold;
cursor: pointer;
&.active {
2020-03-23 00:43:49 +00:00
color: var(--primary);
.icon {
2020-03-23 00:43:49 +00:00
fill: var(--primary);
}
}
&:hover:not(.active) {
2020-03-23 00:43:49 +00:00
color: var(--primary);
.icon {
2020-03-23 00:43:49 +00:00
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);
}
}
.menu-items {
list-style: none;
padding: 0;
margin: 0;
}
.menu-item {
display: flex;
padding: .75rem 1rem .75rem .75rem;
.icon {
fill: var(--darken);
margin: 0 1rem 0 0;
}
&.disabled {
color: var(--darken-weak);
cursor: default;
.icon {
fill: var(--darken-weak);
}
}
&:hover:not(.disabled) {
cursor: pointer;
color: var(--primary);
.icon {
fill: var(--primary);
}
}
}
.search-compact {
display: none;
height: 100%;
}
.search-button {
2020-02-26 00:15:50 +00:00
height: 100%;
padding: .25rem 1rem 0 1rem;
background: none;
2020-02-26 00:15:50 +00:00
border: none;
outline: none;
.icon {
2020-03-23 00:43:49 +00:00
fill: var(--shadow);
2020-02-26 00:15:50 +00:00
}
&:hover {
cursor: pointer;
.icon {
fill: var(--shadow-strong);
}
}
}
2020-02-26 00:15:50 +00:00
2020-07-05 02:40:57 +00:00
@media(max-width: $breakpoint-kilo) {
.search-full {
display: none;
2020-02-26 00:15:50 +00:00
}
.search-compact {
display: flex;
2020-02-26 00:15:50 +00:00
}
.header-account {
padding: 1rem .5rem 1rem 1rem;
}
2020-02-26 00:15:50 +00:00
}
@media(max-width: $breakpoint-small) {
.sidebar-toggle {
display: flex;
}
2020-07-20 02:20:33 +00:00
.logo-link {
2021-01-17 22:43:00 +00:00
margin: -.25rem 1.25rem 0 0;
}
.nav-link {
2021-01-17 22:43:00 +00:00
padding: 0.05rem .75rem 0 .75rem;
}
.search-compact {
display: none;
}
.header-account {
2020-07-05 02:40:57 +00:00
display: none;
}
}
</style>