summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/groups/components/item_type_icon.vue
blob: 118d94d49370b0c9d263bc34336774ee8a42b6cd (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
<script>
import icon from '~/vue_shared/components/icon.vue';
import { ITEM_TYPE } from '../constants';

export default {
  components: {
    icon,
  },
  props: {
    itemType: {
      type: String,
      required: true,
    },
    isGroupOpen: {
      type: Boolean,
      required: true,
      default: false,
    },
  },
  computed: {
    iconClass() {
      if (this.itemType === ITEM_TYPE.GROUP) {
        return this.isGroupOpen ? 'folder-open' : 'folder';
      }
      return 'bookmark';
    },
  },
};
</script>

<template>
  <span class="item-type-icon">
    <icon :name="iconClass"/>
  </span>
</template>