mirror of
https://github.com/Bubka/2FAuth.git
synced 2024-11-27 02:36:06 +01:00
Add new FormToggle vue component
This commit is contained in:
parent
428c83ad82
commit
e427ef90b1
55
resources/js/components/FormToggle.vue
Normal file
55
resources/js/components/FormToggle.vue
Normal file
@ -0,0 +1,55 @@
|
||||
<template>
|
||||
<div class="field" :class="{ 'with-offset' : hasOffset }">
|
||||
<label class="label" v-html="label"></label>
|
||||
<div class="is-toggle buttons">
|
||||
<a class="button is-dark" v-for="choice in choices" :class="{ 'is-link' : form[fieldName] === choice }" @click="form[fieldName] = choice">{{ choice }}</a>
|
||||
</div>
|
||||
<field-error :form="form" :field="fieldName" />
|
||||
<p class="help" v-html="help" v-if="help"></p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'FormToggle',
|
||||
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
props: {
|
||||
label: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
|
||||
fieldName: {
|
||||
type: String,
|
||||
default: '',
|
||||
required: true
|
||||
},
|
||||
|
||||
choices: {
|
||||
type: Array,
|
||||
required: true
|
||||
},
|
||||
|
||||
form: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
|
||||
help: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
|
||||
hasOffset: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
2
resources/js/components/index.js
vendored
2
resources/js/components/index.js
vendored
@ -6,6 +6,7 @@ import FormWrapper from './FormWrapper'
|
||||
import FormField from './FormField'
|
||||
import FormSelect from './FormSelect'
|
||||
import FormSwitch from './FormSwitch'
|
||||
import FormToggle from './FormToggle'
|
||||
import FormCheckbox from './FormCheckbox'
|
||||
import FormButtons from './FormButtons'
|
||||
import VueFooter from './Footer'
|
||||
@ -20,6 +21,7 @@ import Kicker from './Kicker'
|
||||
FormField,
|
||||
FormSelect,
|
||||
FormSwitch,
|
||||
FormToggle,
|
||||
FormCheckbox,
|
||||
FormButtons,
|
||||
VueFooter,
|
||||
|
5
resources/sass/app.scss
vendored
5
resources/sass/app.scss
vendored
@ -366,6 +366,11 @@ figure.no-icon {
|
||||
color: hsl(0, 0%, 48%);
|
||||
}
|
||||
|
||||
.is-toggle.buttons,
|
||||
.is-toggle.buttons a.button {
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
|
||||
.control.has-icons-left .icon, .control.has-icons-right .icon {
|
||||
color: inherit;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user