2024-09-24 01:05:02 +02:00
|
|
|
<template>
|
|
|
|
<div class="avatar">
|
|
|
|
<div class="rounded-full">
|
|
|
|
<img :src="getAvatarUrl(user)" />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
import type { User } from '~/types/user';
|
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
user: User,
|
|
|
|
}>();
|
|
|
|
|
|
|
|
const getAvatarUrl = (user: User) => {
|
|
|
|
if (user.avatar) {
|
|
|
|
return user.avatar;
|
|
|
|
}
|
2024-09-24 20:36:17 +02:00
|
|
|
return 'https://i.pravatar.cc/150?u=' + user.name;
|
2024-09-24 01:05:02 +02:00
|
|
|
};
|
|
|
|
</script>
|