Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dropdown_contents_color_view.vue « color_select_dropdown « components « vue_shared « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 22f3c35b9c3615d1196b22578fc4cf6ccaf1f0df (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
46
47
48
49
50
51
52
53
<script>
import { GlDropdownForm, GlDropdownItem } from '@gitlab/ui';
import ColorItem from './color_item.vue';
import { ISSUABLE_COLORS } from './constants';

export default {
  components: {
    GlDropdownForm,
    GlDropdownItem,
    ColorItem,
  },
  model: {
    prop: 'selectedColor',
  },
  props: {
    selectedColor: {
      type: Object,
      required: true,
    },
  },
  data() {
    return {
      colors: ISSUABLE_COLORS,
    };
  },
  methods: {
    isColorSelected(color) {
      return this.selectedColor.color === color.color;
    },
    handleColorClick(color) {
      this.$emit('input', color);
      this.$emit('closeDropdown', this.selectedColor);
    },
  },
};
</script>

<template>
  <gl-dropdown-form class="js-colors-list">
    <div data-testid="dropdown-content">
      <gl-dropdown-item
        v-for="color in colors"
        :key="color.color"
        :is-checked="isColorSelected(color)"
        is-check-centered
        is-check-item
        @click.native.capture.stop="handleColorClick(color)"
      >
        <color-item :color="color.color" :title="color.title" />
      </gl-dropdown-item>
    </div>
  </gl-dropdown-form>
</template>