mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-12 23:35:58 +00:00
Fix #820 Ok, so after I would have to use the same method in three different locations (`<ds-card>` expects an `image` attribute but cannot render entire components) I decided to implement the prefix of image urls with a filter rather than a component. The downside of this is that we have to add the filter on a lot of component tests. The benefit is less components and hopefully less complexity.
29 lines
613 B
Vue
29 lines
613 B
Vue
<template>
|
|
<ds-avatar
|
|
:image="user && user.avatar | proxyApiUrl"
|
|
:name="userName"
|
|
class="avatar"
|
|
:size="size"
|
|
/>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
name: 'HcAvatar',
|
|
props: {
|
|
user: { type: Object, default: null },
|
|
size: { type: String, default: 'small' },
|
|
},
|
|
computed: {
|
|
userName() {
|
|
const { name } = this.user || {}
|
|
// The name is used to display the initials in case
|
|
// the image cannot be loaded.
|
|
return name
|
|
// If the name is undefined, then our styleguide will
|
|
// display an icon for the anonymous user.
|
|
},
|
|
},
|
|
}
|
|
</script>
|