knowyt/client/src/components/TopBar.vue

67 lines
1.3 KiB
Vue
Raw Normal View History

<template>
<div class="topbar__container">
<div class="topbar__username">
&lt;username&gt;
</div>
<div class="topbar__separator" />
<div class="topbar__actionbar">
Topbar
</div>
<div class="topbar__separator" />
<div class="topbar__logout-button-container">
<Button class="topbar__logout-button" :border="false" @click="actionLogout">Logout</Button>
</div>
</div>
</template>
<script setup lang="ts">
import { useRouter } from '#app'
import useAuth from '@/composables/useAuth';
const actionLogout = async () => {
await useAuth().logout()
useRouter().push('/')
}
</script>
<style lang="scss">
@import '~/assets/css/components';
.topbar {
&__container {
display: flex;
width: 100%;
height: 64px;
align-items: center;
background-color: $topbar-background-color;
}
&__username,
&__logout-button-container {
width: 128px;
padding: 0 16px;
text-align: center;
color: $text-primary-color;
}
&__actionbar {
flex-grow: 1;
}
&__separator {
width: 1px;
height: calc(64px - 2 * 16px);
margin: 16px 0;
background-color: $topbar-separator-color;
}
&__logout-button {
color: $text-primary-color;
&:hover {
color: $text-primary-hover-color;
}
}
}
</style>