blob: 31094b985a2272feea68d249d41fb4d623b6c293 (
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
|
<script>
import { GlButton } from '@gitlab/ui';
import { __ } from '~/locale';
export default {
components: { GlButton },
props: {
defaultExpanded: {
type: Boolean,
default: false,
required: false,
},
},
data() {
return {
sectionExpanded: false,
};
},
computed: {
expanded() {
return this.defaultExpanded || this.sectionExpanded;
},
toggleText() {
return this.expanded ? __('Collapse') : __('Expand');
},
},
};
</script>
<template>
<section class="settings no-animate" :class="{ expanded }">
<div class="settings-header">
<h4><slot name="title"></slot></h4>
<gl-button @click="sectionExpanded = !sectionExpanded">
{{ toggleText }}
</gl-button>
<p>
<slot name="description"></slot>
</p>
</div>
<div class="settings-content">
<slot></slot>
</div>
</section>
</template>
|