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 { GlIcon, GlTooltipDirective } from '@gitlab/ui';
import { COLOR_WIDGET_COLOR } from './constants';
import ColorItem from './color_item.vue';
export default {
i18n: {
dropdownTitle: COLOR_WIDGET_COLOR,
},
directives: {
GlTooltip: GlTooltipDirective,
},
components: {
GlIcon,
ColorItem,
},
props: {
selectedColor: {
type: Object,
required: true,
},
},
computed: {
hasColor() {
return this.selectedColor.color !== '';
},
},
};
</script>
<template>
<div class="value js-value">
<div
v-gl-tooltip.left.viewport
:title="$options.i18n.dropdownTitle"
class="sidebar-collapsed-icon"
>
<gl-icon name="appearance" />
<color-item :color="selectedColor.color" :title="selectedColor.title" />
</div>
<span v-if="!hasColor" class="no-value hide-collapsed">
<slot></slot>
</span>
<template v-else>
<color-item
class="hide-collapsed"
:color="selectedColor.color"
:title="selectedColor.title"
/>
</template>
</div>
</template>
|