summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/vue_shared/components/user_avatar/user_avatar_svg.vue
blob: ef3b16edf5f96e394a110ed9f9f360c635202c84 (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
38
39
40
41
42
43
44
45
<script>

/* This is a re-usable vue component for rendering a user avatar svg (typically
  for a blank state). It will receive styles comparable to the user avatar,
  but no image is loaded, it isn't wrapped in a link, and tooltips aren't supported.
  The svg and avatar size can be configured by props passed to this component.

  Sample configuration:

  <user-avatar-svg
    :svg="potentialApproverSvg"
    :size="20"
  />

*/

export default {
  props: {
    svg: {
      type: String,
      required: true,
    },
    size: {
      type: Number,
      required: false,
      default: 20,
    },
  },
  computed: {
    avatarSizeClass() {
      return `s${this.size}`;
    },
  },
};
</script>

<template>
  <svg
    :class="avatarSizeClass"
    :height="size"
    :width="size"
    v-html="svg"
  />
</template>