summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/vue_shared/components/identicon.vue
blob: 0862f2c0cffb248defb4820f3c23fdb8d1127f33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<script>
import { getIdenticonBackgroundClass, getIdenticonTitle } from '~/helpers/avatar_helper';

export default {
  props: {
    entityId: {
      type: Number,
      required: true,
    },
    entityName: {
      type: String,
      required: true,
    },
    sizeClass: {
      type: String,
      required: false,
      default: 's40',
    },
  },
  computed: {
    identiconBackgroundClass() {
      return getIdenticonBackgroundClass(this.entityId);
    },
    identiconTitle() {
      return getIdenticonTitle(this.entityName);
    },
  },
};
</script>

<template>
  <div
    :class="[sizeClass, identiconBackgroundClass]"
    class="avatar identicon">
    {{ identiconTitle }}
  </div>
</template>