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
|
<script>
import { GlButton } from '@gitlab/ui';
export default {
components: {
GlButton,
},
props: {
text: {
type: String,
required: false,
default: '',
},
show: {
type: Boolean,
required: false,
default: true,
},
},
data() {
return {
isVisible: this.show,
};
},
mounted() {
this.toggleBanner(this.isVisible);
},
methods: {
toggleBanner(isVisible) {
this.$emit('toggle', isVisible);
this.isVisible = isVisible;
},
},
};
</script>
<template>
<div
v-if="isVisible"
class="gl-z-index-3 gl-left-0 gl-bg-gray-50 gl-border-b-gray-200 gl-fixed gl-w-full gl-text-center"
>
<span v-if="text">{{ text }}</span>
<slot></slot>
<gl-button
icon="close"
class="gl-shadow-none! gl-bg-transparent!"
@click="toggleBanner(false)"
/>
</div>
</template>
|