aboutsummaryrefslogtreecommitdiff
path: root/src/components/user_avatar
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/user_avatar')
-rw-r--r--src/components/user_avatar/user_avatar.js29
-rw-r--r--src/components/user_avatar/user_avatar.vue37
2 files changed, 66 insertions, 0 deletions
diff --git a/src/components/user_avatar/user_avatar.js b/src/components/user_avatar/user_avatar.js
new file mode 100644
index 00000000..e513b993
--- /dev/null
+++ b/src/components/user_avatar/user_avatar.js
@@ -0,0 +1,29 @@
+import StillImage from '../still-image/still-image.vue'
+
+const UserAvatar = {
+ props: [
+ 'src',
+ 'betterShadow',
+ 'compact'
+ ],
+ data () {
+ return {
+ showPlaceholder: false
+ }
+ },
+ components: {
+ StillImage
+ },
+ computed: {
+ imgSrc () {
+ return this.showPlaceholder ? '/images/avi.png' : this.src
+ }
+ },
+ methods: {
+ imageLoadError () {
+ this.showPlaceholder = true
+ }
+ }
+}
+
+export default UserAvatar
diff --git a/src/components/user_avatar/user_avatar.vue b/src/components/user_avatar/user_avatar.vue
new file mode 100644
index 00000000..3ec25b21
--- /dev/null
+++ b/src/components/user_avatar/user_avatar.vue
@@ -0,0 +1,37 @@
+<template>
+ <StillImage class="avatar" :class="{ 'avatar-compact': compact, 'better-shadow': betterShadow }" :src="imgSrc" :imageLoadError="imageLoadError"/>
+</template>
+
+<script src="./user_avatar.js"></script>
+<style lang="scss">
+@import '../../_variables.scss';
+
+.avatar.still-image {
+ width: 48px;
+ height: 48px;
+ box-shadow: var(--avatarStatusShadow);
+ border-radius: $fallback--avatarRadius;
+ border-radius: var(--avatarRadius, $fallback--avatarRadius);
+
+ img {
+ width: 100%;
+ height: 100%;
+ }
+
+ &.better-shadow {
+ box-shadow: var(--avatarStatusShadowInset);
+ filter: var(--avatarStatusShadowFilter)
+ }
+
+ &.animated::before {
+ display: none;
+ }
+
+ &.avatar-compact {
+ width: 32px;
+ height: 32px;
+ border-radius: $fallback--avatarAltRadius;
+ border-radius: var(--avatarAltRadius, $fallback--avatarAltRadius);
+ }
+}
+</style>