143 lines
2.8 KiB
Vue
143 lines
2.8 KiB
Vue
<template>
|
|
<header :class="[darkMode ? 'header-darkmode' : 'header-lightmode']">
|
|
<img id="header-logo" loading="lazy" src="/tüit-logo.svg.png" />
|
|
<div class="profile">
|
|
<pre :class="['username', darkMode ? 'username-darkmode' : 'username-lightmode']" id='uname'></pre>
|
|
<div :class="['picture', darkMode ? 'picture-darkmode' : 'picture-lightmode']">
|
|
<img id="picture" loading="lazy" src="" />
|
|
</div>
|
|
</div>
|
|
</header>
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
import { useAuthStore } from '~/store/auth';
|
|
import { ref } from 'vue';
|
|
|
|
const darkMode = ref(true)
|
|
|
|
//const auth = ref();
|
|
const username = ref('username');
|
|
|
|
onMounted(() => {
|
|
//auth.value = useAuthStore();
|
|
//username.value = auth.value.username;
|
|
try {
|
|
username.value = useAuthStore().username;
|
|
} finally {
|
|
document.getElementById('uname').innerHTML = username;
|
|
}
|
|
});
|
|
|
|
onUpdated(() => {
|
|
try {
|
|
username.value = useAuthStore().username;
|
|
} finally {
|
|
document.getElementById('uname').innerHTML = username;
|
|
}
|
|
})
|
|
|
|
</script>
|
|
|
|
|
|
<script>
|
|
import { useAuthStore } from '~/store/auth';
|
|
|
|
export default {
|
|
name: "PageHeader",
|
|
/*mounted() {
|
|
try {
|
|
const auth = useAuthStore();
|
|
const username = auth.username;
|
|
document.getElementById('uname').innerHTML = username;
|
|
} catch {
|
|
document.getElementById('uname').innerHTML = 'username'
|
|
}
|
|
},
|
|
updated() {
|
|
const auth = useAuthStore();
|
|
const username = auth.username;
|
|
document.getElementById('uname').innerHTML = username;
|
|
},*/
|
|
}
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
* {
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
header {
|
|
display: flex;
|
|
flex-direction: row;
|
|
position: sticky;
|
|
top: 0;
|
|
width: 100%;
|
|
height: 3.125rem;
|
|
align-self: stretch;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
padding: 0.375rem 1.875rem;
|
|
}
|
|
|
|
.header-darkmode {
|
|
background-color: #212121;
|
|
border-bottom: 0.125em solid #000000;
|
|
}
|
|
|
|
.header-lightmode {
|
|
background-color: #ebebeb;
|
|
border-bottom: 0.125em solid #8e8e8e;
|
|
}
|
|
|
|
#header-logo {
|
|
object-fit: contain;
|
|
object-position: center;
|
|
width: 4rem;
|
|
height: 2rem;
|
|
justify-content: center;
|
|
align-items: center;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.profile {
|
|
display: flex;
|
|
flex-direction: row;
|
|
align-items: flex-end;
|
|
gap: 0.625rem;
|
|
padding: 0 0.375rem;
|
|
}
|
|
|
|
.username {
|
|
align-self: center;
|
|
text-align: right;
|
|
font: 200 0.75rem/1.25rem Overpass, sans-serif;
|
|
letter-spacing: 0.01rem;
|
|
}
|
|
|
|
.username-darkmode {
|
|
color: #ffffff;
|
|
}
|
|
|
|
.username-lightmode {
|
|
color: #000000;
|
|
}
|
|
|
|
.picture {
|
|
display: flex;
|
|
width: 1.875rem;
|
|
height: 1.875rem;
|
|
border-radius: 50%;
|
|
}
|
|
|
|
.picture-darkmode {
|
|
background-color: #ffffff;
|
|
}
|
|
|
|
.picture-lightmode {
|
|
background-color: #000000;
|
|
}
|
|
</style> |