forked from openWB/openwb-ui-settings
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOpenwbBaseSettingElement.vue
53 lines (50 loc) · 1.28 KB
/
OpenwbBaseSettingElement.vue
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
<template>
<div class="form-row mb-1 align-items-baseline">
<label v-on:click="toggleHelp" class="col-md-4 col-form-label">
<slot name="title">*Title*</slot>
<font-awesome-icon
v-if="$slots.help"
:icon="
showHelp
? ['fas', 'question-circle']
: ['far', 'question-circle']
"
class="ml-1"
:class="showHelp ? 'text-info' : ''"
/>
</label>
<div class="col-md-8">
<div class="form-row">
<slot>*Element missing*</slot>
</div>
<div class="form-row">
<span v-if="showHelp" class="form-text alert alert-info my-1 small flex-fill">
<slot name="help">*Help Text*</slot>
</span>
</div>
</div>
</div>
</template>
<script>
import { library } from "@fortawesome/fontawesome-svg-core";
import { faQuestionCircle as fasQuestionCircle } from "@fortawesome/free-solid-svg-icons";
import { faQuestionCircle as farQuestionCircle } from "@fortawesome/free-regular-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
library.add(fasQuestionCircle, farQuestionCircle);
export default {
name: "OpenwbSettingElement",
data() {
return {
showHelp: false,
};
},
methods: {
toggleHelp() {
this.showHelp = !this.showHelp && this.$slots.help !== undefined;
},
},
components: {
FontAwesomeIcon,
},
};
</script>