debian-mirror-gitlab/app/assets/javascripts/vue_shared/components/identicon.vue

36 lines
700 B
Vue
Raw Normal View History

2017-09-10 17:25:29 +05:30
<script>
2018-11-18 11:00:15 +05:30
import { getIdenticonBackgroundClass, getIdenticonTitle } from '~/helpers/avatar_helper';
2017-09-10 17:25:29 +05:30
export default {
props: {
entityId: {
type: Number,
required: true,
},
entityName: {
type: String,
required: true,
},
2018-03-17 18:26:18 +05:30
sizeClass: {
type: String,
required: false,
default: 's40',
},
2017-09-10 17:25:29 +05:30
},
computed: {
2018-11-18 11:00:15 +05:30
identiconBackgroundClass() {
return getIdenticonBackgroundClass(this.entityId);
2017-09-10 17:25:29 +05:30
},
identiconTitle() {
2018-11-18 11:00:15 +05:30
return getIdenticonTitle(this.entityName);
2017-09-10 17:25:29 +05:30
},
},
};
</script>
<template>
2019-02-15 15:39:39 +05:30
<div :class="[sizeClass, identiconBackgroundClass]" class="avatar identicon">
2018-03-17 18:26:18 +05:30
{{ identiconTitle }}
2017-09-10 17:25:29 +05:30
</div>
</template>