traxxx-web/components/header/header.vue

154 lines
2.4 KiB
Vue
Raw Normal View History

<template>
<header class="header">
<nav class="nav">
2024-02-22 04:08:06 +00:00
<Link href="/">
<h1 class="title">
<div
class="logo"
v-html="logo"
/>
</h1>
</Link>
<ul class="nav-list nolist">
<li class="nav-item">
<Link
class="link"
href="/updates"
>Updates</Link>
</li>
<li class="nav-item">
<Link
class="link"
href="/actors"
>Actors</Link>
</li>
<li class="nav-item">
<Link
class="link"
href="/channels"
>Channels</Link>
</li>
<li class="nav-item">
<Link
class="link"
href="/tags"
>Tags</Link>
</li>
<li class="nav-item">
<Link
class="link"
href="/movies"
>Movies</Link>
</li>
</ul>
</nav>
2024-02-22 04:08:06 +00:00
<form
class="search"
@submit.prevent="search"
>
<input
v-model="query"
type="search"
placeholder="Search"
class="input"
>
<Icon icon="search" />
</form>
</header>
</template>
<script setup>
2024-02-22 04:08:06 +00:00
import { ref, inject } from 'vue';
import navigate from '#/src/navigate.js';
import logo from '../../assets/img/logo.svg?raw'; // eslint-disable-line import/no-unresolved
2024-02-22 04:08:06 +00:00
const pageContext = inject('pageContext');
const query = ref(pageContext.urlParsed.search.q || '');
function search() {
navigate('/search', { q: query.value }, { redirect: true });
}
</script>
<style scoped>
.header {
display: flex;
align-items: center;
2024-02-22 04:08:06 +00:00
justify-content: space-between;
z-index: 1000; /* make sure shadow shows up above content */
box-shadow: 0 0 3px var(--shadow-weak-10);
}
.title {
margin: 0;
display: inline-block;
}
.logo {
display: flex;
width: 8rem;
height: 3rem;
box-sizing: border-box;
padding: .75rem;
margin-right: 1rem;
fill: var(--primary);
}
.nav {
2024-02-22 04:08:06 +00:00
display: flex;
align-items: center;
}
.nav-item .link {
font-size: .9rem;
color: var(--shadow-strong-10);
box-sizing: border-box;
padding: 1rem;
height: 100%;
&:hover {
text-decoration: none;
}
}
.link {
font-weight: bold;
&.active {
color: var(--primary);
}
}
2024-02-22 04:08:06 +00:00
.search {
height: 100%;
display: flex;
align-items: center;
flex-direction: row-reverse;
.input {
height: 100%;
border: none;
border-radius: 0;
border-left: solid 1px var(--shadow-weak-30);
background: var(--background);
}
.icon {
margin-right: .75rem;
fill: var(--shadow-weak-10);
}
.input:focus + .icon {
fill: var(--primary);
}
}
</style>