feat: implement generic <Avatar> component

This commit is contained in:
Twig 2025-07-14 21:39:00 +02:00
parent f4ddcf9d8d
commit f98e8c6110
No known key found for this signature in database
5 changed files with 82 additions and 6 deletions

View file

@ -1,8 +1,8 @@
<template>
<NuxtLink class="user-item" :href="`/me/${user.uuid}`" tabindex="0">
<img v-if="props.user.avatar" class="user-avatar" :src="props.user.avatar" :alt="props.user.display_name ?? props.user.username" />
<Icon v-else class="user-avatar" name="lucide:user" />
<span class="user-display-name">{{ props.user.display_name || props.user.username }}</span>
<Avatar :user="props.user" class="user-avatar"/>
<span class="user-display-name">{{ displayName }}</span>
</NuxtLink>
</template>
@ -12,6 +12,8 @@ import type { UserResponse } from '~/types/interfaces';
const props = defineProps<{
user: UserResponse
}>();
const displayName = props.user.display_name || props.user.username
</script>
<style>