shack/renderer/container.vue

115 lines
1.8 KiB
Vue
Raw Normal View History

<template>
<div class="container">
<header class="header">
<a href="/">
<h1 class="title">
<div
class="logo"
v-html="logo"
/>shack
</h1>
</a>
<div class="search">
<input
type="search"
class="input"
placeholder="Search the shack"
>
</div>
<span
2023-06-25 17:52:00 +00:00
v-if="me"
class="userpanel"
@click="logout"
2023-06-25 17:52:00 +00:00
>{{ me.username }}</span>
</header>
<div class="content-container">
<slot />
2023-06-05 23:30:46 +00:00
<footer class="footer">shack {{ version }}</footer>
</div>
</div>
</template>
<script setup>
2023-06-11 03:32:02 +00:00
import logo from '../assets/img/logo.svg?raw'; // eslint-disable-line import/no-unresolved
import { del } from '../assets/js/api';
2023-06-25 17:52:00 +00:00
import { navigate } from '../assets/js/navigate';
2023-06-11 03:32:02 +00:00
import { usePageContext } from './usePageContext';
2023-06-25 17:52:00 +00:00
const { me } = usePageContext();
const version = CLIENT_VERSION;
async function logout() {
2023-06-25 17:52:00 +00:00
await del('/session');
navigate('/account/login');
}
</script>
<style>
.logo svg {
height: 100%;
width: auto;
}
</style>
<style scoped>
.container {
height: 100%;
display: flex;
flex-direction: column;
background: var(--background-dark-10);
}
.content-container {
display: flex;
flex-direction: column;
flex-grow: 1;
overflow-y: auto;
}
.header {
display: flex;
flex-shrink: 0;
background: var(--background);
box-shadow: 0 0 3px var(--shadow-weak-10);
overflow: hidden;
}
.logo {
width: auto;
height: 1.75rem;
fill: var(--primary);
margin: .75rem .5rem 1rem 1rem;
}
.title {
font-size: 0;
}
.search {
display: flex;
flex-grow: 1;
align-items: center;
margin: 0 1rem;
.input {
flex-grow: 1;
}
}
.userpanel {
display: flex;
align-items: center;
padding: 1rem;
font-weight: bold;
}
.footer {
padding: .5rem 1rem;
color: var(--shadow);
text-align: center;
}
</style>