summaryrefslogtreecommitdiff
path: root/components/UserAvatar.vue
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2022-09-18 18:46:42 +0200
committerSanto Cariotti <santo@dcariotti.me>2022-09-18 18:46:42 +0200
commit9382162c78a2991804885c8a7e36b599f45d0038 (patch)
tree4eaec09788cf3d9d997c14ffc57031b3587d6fc7 /components/UserAvatar.vue
parent51e00ddb2d757c8f01af12ff9fe250789825fc71 (diff)
Component for user avatar
Diffstat (limited to 'components/UserAvatar.vue')
-rw-r--r--components/UserAvatar.vue20
1 files changed, 20 insertions, 0 deletions
diff --git a/components/UserAvatar.vue b/components/UserAvatar.vue
new file mode 100644
index 0000000..4d45ee0
--- /dev/null
+++ b/components/UserAvatar.vue
@@ -0,0 +1,20 @@
+<template lang="pug">
+ div(v-if="data")
+ img.h-8.w-8.rounded-full(v-if="data.avatar" :src="baseAPI+''+data.avatar" alt="Avatar")
+ span.h-8.w-8.rounded-full.bg-white.pt-1(v-else) {{ data.username[0] }}
+</template>
+
+<script>
+export default {
+ name: "UserAvatar",
+ props: ["data"],
+ data() {
+ return {
+ baseAPI: "",
+ };
+ },
+ created() {
+ this.baseAPI = this.$config.api;
+ },
+};
+</script>