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
54
55
56
57
58
59
60
61
62
63
64
|
<script>
import { GlIcon, GlTooltipDirective } from '@gitlab/ui';
import { __, sprintf } from '~/locale';
export default {
components: {
GlIcon,
},
directives: {
GlTooltip: GlTooltipDirective,
},
props: {
confidential: {
type: Boolean,
required: true,
},
issuableType: {
type: String,
required: true,
},
},
computed: {
confidentialText() {
return this.confidential
? sprintf(__('This %{issuableType} is confidential'), {
issuableType: this.issuableType,
})
: __('Not confidential');
},
confidentialIcon() {
return this.confidential ? 'eye-slash' : 'eye';
},
tooltipLabel() {
return this.confidential ? __('Confidential') : __('Not confidential');
},
},
};
</script>
<template>
<div>
<div
v-gl-tooltip.viewport.left
:title="tooltipLabel"
class="sidebar-collapsed-icon"
data-testid="sidebar-collapsed-icon"
@click="$emit('expandSidebar')"
>
<gl-icon
:size="16"
:name="confidentialIcon"
class="sidebar-item-icon inline"
:class="{ 'is-active': confidential }"
/>
</div>
<gl-icon
:size="16"
:name="confidentialIcon"
class="sidebar-item-icon inline hide-collapsed"
:class="{ 'is-active': confidential }"
/>
<span class="hide-collapsed" data-testid="confidential-text">{{ confidentialText }}</span>
</div>
</template>
|