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

36 lines
726 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: {
2020-05-24 23:13:21 +05:30
type: [Number, String],
2017-09-10 17:25:29 +05:30
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>
2020-03-09 13:42:32 +05:30
<div ref="identicon" :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>