akkoma-fe/src/components/user_avatar/user_avatar.vue

73 lines
1.5 KiB
Vue
Raw Normal View History

<template>
2019-02-05 15:17:50 +00:00
<StillImage
v-if="user"
class="Avatar"
:alt="user.screen_name_ui"
:title="user.screen_name_ui"
:src="imgSrc(user.profile_image_url_original)"
2019-02-05 15:17:50 +00:00
:class="{ 'avatar-compact': compact, 'better-shadow': betterShadow }"
2019-07-05 07:17:44 +00:00
:image-load-error="imageLoadError"
>
2022-03-14 07:35:29 +00:00
<FAIcon
v-if="bot"
icon="robot"
class="bot-indicator"
/>
</StillImage>
<div
v-else
class="Avatar -placeholder"
:class="{ 'avatar-compact': compact }"
/>
</template>
<script src="./user_avatar.js"></script>
2019-02-02 19:33:13 +00:00
<style lang="scss">
@import '../../_variables.scss';
.Avatar {
--_avatarShadowBox: var(--avatarStatusShadow);
--_avatarShadowFilter: var(--avatarStatusShadowFilter);
--_avatarShadowInset: var(--avatarStatusShadowInset);
2020-10-29 19:39:36 +00:00
--_still-image-label-visibility: hidden;
2019-02-02 19:33:13 +00:00
width: 48px;
height: 48px;
box-shadow: var(--_avatarShadowBox);
2019-02-02 19:33:13 +00:00
border-radius: $fallback--avatarRadius;
border-radius: var(--avatarRadius, $fallback--avatarRadius);
img {
width: 100%;
height: 100%;
}
2019-02-02 19:33:13 +00:00
& > .bot-indicator {
position: absolute;
bottom: 0;
right: 0;
}
2019-02-02 19:33:13 +00:00
&.better-shadow {
box-shadow: var(--_avatarShadowInset);
filter: var(--_avatarShadowFilter);
2019-02-02 19:33:13 +00:00
}
&.animated::before {
display: none;
}
&.avatar-compact {
width: 32px;
height: 32px;
border-radius: $fallback--avatarAltRadius;
border-radius: var(--avatarAltRadius, $fallback--avatarAltRadius);
2019-02-02 19:33:13 +00:00
}
&.-placeholder {
background-color: $fallback--fg;
background-color: var(--fg, $fallback--fg);
}
2019-02-02 19:33:13 +00:00
}
</style>