Skip to content

Commit 782d625

Browse files
committed
create new base component
1 parent 0f9e686 commit 782d625

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<template>
2+
<div class="form-row mb-1 align-items-baseline">
3+
<label v-on:click="toggleHelp" class="col-md-4 col-form-label">
4+
<slot name="title">*Title*</slot>
5+
<font-awesome-icon
6+
v-if="$slots.help"
7+
:icon="
8+
showHelp
9+
? ['fas', 'question-circle']
10+
: ['far', 'question-circle']
11+
"
12+
class="ml-1"
13+
:class="showHelp ? 'text-info' : ''"
14+
/>
15+
</label>
16+
<div class="col-md-8">
17+
<div class="form-row">
18+
<slot>*Element missing*</slot>
19+
</div>
20+
<div class="form-row">
21+
<span v-if="showHelp" class="form-text alert alert-info my-1 small flex-fill">
22+
<slot name="help">*Help Text*</slot>
23+
</span>
24+
</div>
25+
</div>
26+
</div>
27+
</template>
28+
29+
<script>
30+
import { library } from "@fortawesome/fontawesome-svg-core";
31+
import { faQuestionCircle as fasQuestionCircle } from "@fortawesome/free-solid-svg-icons";
32+
import { faQuestionCircle as farQuestionCircle } from "@fortawesome/free-regular-svg-icons";
33+
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
34+
35+
library.add(fasQuestionCircle, farQuestionCircle);
36+
37+
export default {
38+
name: "OpenwbSettingElement",
39+
data() {
40+
return {
41+
showHelp: false,
42+
};
43+
},
44+
methods: {
45+
toggleHelp() {
46+
this.showHelp = !this.showHelp && this.$slots.help !== undefined;
47+
},
48+
},
49+
components: {
50+
FontAwesomeIcon,
51+
},
52+
};
53+
</script>

0 commit comments

Comments
 (0)