Remove avatar background in header

This commit is contained in:
Nassim Jahnke 2022-03-29 16:15:06 +02:00
parent 5dedc4f188
commit 66fe3a9c00
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
2 changed files with 8 additions and 2 deletions

View File

@ -8,12 +8,14 @@ const props = withDefaults(
imgSrc?: string;
to?: string;
size?: "xs" | "sm" | "md" | "lg" | "xl";
background?: boolean;
}>(),
{
avatarUrl: undefined,
imgSrc: undefined,
size: "lg",
to: "",
background: true,
}
);
@ -28,6 +30,10 @@ const sizeClass = computed(() => {
return "w-200px h-200px";
});
const backgroundClass = computed(() => {
return props.background ? "bg-light-300 dark:bg-dark-500 " : "";
});
const src = computed(() => {
if (errored.value) {
return "https://docs.papermc.io/img/paper.png";
@ -52,7 +58,7 @@ const url = computed(() => {
</script>
<template>
<div :class="'bg-light-300 dark:bg-dark-500 rounded-lg ' + sizeClass">
<div :class="'rounded-lg ' + backgroundClass + sizeClass">
<router-link :to="url">
<img class="rounded-lg w-full h-full" :title="username" :src="src" :alt="username" @error="errored = true" />
</router-link>

View File

@ -149,7 +149,7 @@ authLog("render with user " + authStore.user?.name);
<Menu>
<MenuButton>
<div class="flex items-center gap-2 rounded-md p-2" hover="text-primary-100 bg-primary-50">
<UserAvatar :username="name" size="xs"></UserAvatar>
<UserAvatar :username="authStore.user.name" size="xs" :background="false"></UserAvatar>
{{ authStore.user.name }}
</div>
</MenuButton>