51 lines
1.0 KiB
Vue
Raw Normal View History

<template>
<div class="user-picture">
<img
v-if="authUserPictureUrl !== ''"
2021-11-01 20:48:22 +01:00
class="profile-user-img"
2021-10-20 17:38:25 +02:00
:alt="$t('user.USER_PICTURE')"
:src="authUserPictureUrl"
/>
<div v-else class="no-picture">
<i class="fa fa-user-circle-o" aria-hidden="true" />
</div>
</div>
</template>
<script setup lang="ts">
import { computed } from 'vue'
2021-10-30 12:01:55 +02:00
import { IUserProfile } from '@/types/user'
import { getApiUrl } from '@/utils'
2021-10-20 17:38:25 +02:00
interface Props {
user: IUserProfile
}
const props = defineProps<Props>()
const authUserPictureUrl = computed(() =>
props.user.picture
? `${getApiUrl()}users/${props.user.username}/picture?${Date.now()}`
: ''
)
</script>
<style lang="scss">
.user-picture {
display: flex;
justify-content: center;
align-items: center;
min-width: 30%;
2021-11-11 09:41:23 +01:00
line-height: 1.2em;
img {
border-radius: 50%;
height: 90px;
width: 90px;
}
.no-picture {
color: var(--app-a-color);
font-size: 5.5em;
}
}
</style>