summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/groups/components/item_type_icon.vue
blob: c3787c2df21732069f24aa3daa24502ad92d7d69 (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
<script>
import { GlIcon } from '@gitlab/ui';
import { ITEM_TYPE } from '../constants';

export default {
  components: {
    GlIcon,
  },
  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-o';
      }
      return 'bookmark';
    },
  },
};
</script>

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