Skip to content

Commit

Permalink
feat(components): checkboxes to vuestic-components (epicmaxco#111)
Browse files Browse the repository at this point in the history
* feat(components): checkboxes to vuestic-components

* fixed: issues with vuestic-checkbox

* fixed: tabs and indents in changed files
  • Loading branch information
asyncurious authored and smartapant committed Mar 26, 2018
1 parent b7ad0e3 commit 4c8053d
Show file tree
Hide file tree
Showing 5 changed files with 147 additions and 63 deletions.
20 changes: 13 additions & 7 deletions src/components/auth/signup/Signup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
<label class="control-label" for="password">{{'auth.password' | translate}}</label><i class="bar"></i>
</div>
</div>
<div class="form-check abc-checkbox abc-checkbox-primary">
<input class="form-check-input" id="checkbox1" type="checkbox" checked>
<label class="form-check-label" for="checkbox1">
<span class="abc-label-text">{{'auth.agree' | translate}} <router-link to="">{{'auth.termsOfUse' | translate}}</router-link></span>
</label>
</div>
<vuestic-checkbox
:id="'checkbox1'"
v-model="checkboxOneModel">
<template slot="label">{{'auth.agree' | translate}}
<router-link to="">{{'auth.termsOfUse' | translate}}</router-link>
</template>
</vuestic-checkbox>
<div class="d-flex flex-column flex-lg-row align-items-center justify-content-between down-container">
<button class="btn btn-primary" type="submit">
{{'auth.signUp' | translate}}
Expand All @@ -32,7 +33,12 @@

<script>
export default {
name: 'signup'
name: 'signup',
data () {
return {
checkboxOneModel: true
}
}
}
</script>

Expand Down
98 changes: 49 additions & 49 deletions src/components/forms/form-elements/FormElements.vue
Original file line number Diff line number Diff line change
Expand Up @@ -165,59 +165,51 @@
<div class="row">
<div class="col-md-3">
<fieldset>
<div class="form-check abc-checkbox abc-checkbox-primary">
<input class="form-check-input" id="checkbox1" type="checkbox">
<label class="form-check-label" for="checkbox1">
<span class="abc-label-text">{{'forms.controls.subscribe' | translate}}</span>
</label>
</div>
<div class="form-check abc-checkbox abc-checkbox-primary">
<input class="form-check-input" id="checkbox2" type="checkbox" checked>
<label class="form-check-label" for="checkbox2">
<span class="abc-label-text">{{'forms.controls.subscribe' | translate}}</span>
</label>
</div>
<div class="form-check abc-checkbox abc-checkbox-primary">
<input class="form-check-input" id="checkbox3" type="checkbox" disabled>
<label class="form-check-label" for="checkbox3">
<span class="abc-label-text">{{'forms.controls.subscribe' | translate}}</span>
</label>
</div>
<div class="form-check abc-checkbox abc-checkbox-primary">
<input class="form-check-input" id="checkbox4" type="checkbox" disabled checked>
<label class="form-check-label" for="checkbox4">
<span class="abc-label-text">{{'forms.controls.subscribe' | translate}}</span>
</label>
</div>
<vuestic-checkbox
:label="'forms.controls.subscribe' | translate"
:id="'checkbox1'"
v-model="checkboxOneModel"/>
<vuestic-checkbox
:label="'forms.controls.subscribe' | translate"
:id="'checkbox2'"
v-model="checkboxTwoModel"/>
<vuestic-checkbox
:label="'forms.controls.subscribe' | translate"
:id="'checkbox3'"
:disabled="true"
v-model="checkboxThreeModel"/>
<vuestic-checkbox
:label="'forms.controls.subscribe' | translate"
:id="'checkbox4'"
:disabled="true"
v-model="checkboxFourModel"/>
</fieldset>
</div>

<div class="col-md-3">
<fieldset>
<div class="form-check abc-checkbox abc-checkbox-primary abc-checkbox-circle">
<input class="form-check-input" id="checkbox7" type="checkbox">
<label class="form-check-label" for="checkbox7">
<span class="abc-label-text">{{'forms.controls.subscribe' | translate}}</span>
</label>
</div>
<div class="form-check abc-checkbox abc-checkbox-primary abc-checkbox-circle">
<input class="form-check-input" id="checkbox8" type="checkbox" checked>
<label class="form-check-label" for="checkbox8">
<span class="abc-label-text">{{'forms.controls.subscribe' | translate}}</span>
</label>
</div>
<div class="form-check abc-checkbox abc-checkbox-primary abc-checkbox-circle">
<input class="form-check-input" id="checkbox9" type="checkbox" disabled>
<label class="form-check-label" for="checkbox9">
<span class="abc-label-text">{{'forms.controls.subscribe' | translate}}</span>
</label>
</div>
<div class="form-check abc-checkbox abc-checkbox-primary abc-checkbox-circle">
<input class="form-check-input" id="checkbox10" type="checkbox" checked disabled>
<label class="form-check-label" for="checkbox10">
<span class="abc-label-text">{{'forms.controls.subscribe' | translate}}</span>
</label>
</div>
<vuestic-checkbox
:label="'forms.controls.subscribe' | translate"
:id="'checkbox5'"
:isCircle="true"
v-model="checkboxFiveModel"/>
<vuestic-checkbox
:label="'forms.controls.subscribe' | translate"
:id="'checkbox6'"
:isCircle="true"
v-model="checkboxSixModel"/>
<vuestic-checkbox
:label="'forms.controls.subscribe' | translate"
:id="'checkbox7'"
:disabled="true"
:isCircle="true"
v-model="checkboxSevenModel"/>
<vuestic-checkbox
:label="'forms.controls.subscribe' | translate"
:id="'checkbox8'"
:disabled="true"
:isCircle="true"
v-model="checkboxEightModel"/>
</fieldset>
</div>

Expand Down Expand Up @@ -312,7 +304,15 @@
multiSelectModel: [],
multiSelectCountriesModel: [],
radioModel: 'option1',
radioDisabledModel: 'option4'
radioDisabledModel: 'option4',
checkboxOneModel: false,
checkboxTwoModel: true,
checkboxThreeModel: false,
checkboxFourModel: true,
checkboxFiveModel: false,
checkboxSixModel: true,
checkboxSevenModel: false,
checkboxEightModel: true
}
},
methods: {
Expand Down
12 changes: 5 additions & 7 deletions src/components/ui/notifications/Notifications.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
the item.
</p>
</div>
</div>
</div>
</vuestic-widget>
</div>
</div>
Expand Down Expand Up @@ -106,12 +106,10 @@
</div>
<div class="form-group toasts-position-group d-flex flex-row">
<toast-position-picker v-model="toastPosition" />
<div class="form-check abc-checkbox abc-checkbox-primary">
<input class="form-check-input" id="toast-fullwidth" v-model="isToastFullWidth" type="checkbox">
<label class="form-check-label" for="toast-fullwidth">
<span class="abc-label-text">{{'notificationsPage.toasts.fullWidthLabel' | translate}}</span>
</label>
</div>
<vuestic-checkbox
:label="'notificationsPage.toasts.fullWidthLabel' | translate"
:id="'toast-fullwidth'"
v-model="isToastFullWidth"/>
</div>
<button slot="trigger" class="btn btn-sm btn-primary" @click="launchToast">
{{'notificationsPage.toasts.launchToast' | translate}}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<template>
<div class="form-check abc-checkbox" :class="additionalClasses">
<input class="form-check-input" :id="id" type="checkbox" :checked="checked" @change="onChange" :disabled="disabled">
<label class="form-check-label" :for="id">
<template v-if="label">
<span class="abc-label-text">{{label}}</span>
</template>
<template v-else>
<span class="abc-label-text">
<slot name="label"></slot>
</span>
</template>
</label>
</div>
</template>

<script>
export default {
name: 'vuestic-checkbox',
props: {
label: String,
id: {
type: String,
required: false
},
checked: {
type: Boolean,
default: false
},
disabled: {
type: Boolean,
default: false
},
name: {
type: String,
default: ''
},
isCircle: {
type: Boolean,
default: false
},
brandColor: {
type: String,
default: 'primary',
validator: value => {
return ['primary', 'secondary', 'success', 'info', 'warning', 'danger'].indexOf(value) >= 0
}
}
},
model: {
prop: 'checked',
event: 'change'
},
mounted () {
this.$emit('change', this.checked)
},
methods: {
onChange (event) {
this.$emit('change', event.target.checked)
}
},
computed: {
additionalClasses () {
return [
this.isCircle ? 'abc-checkbox-circle' : false,
'abc-checkbox-' + this.brandColor
]
}
}
}
</script>

<style lang="scss">
@import "../../../sass/variables";
</style>
2 changes: 2 additions & 0 deletions src/vuestic-theme/vuestic-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Alert from './vuestic-components/vuestic-alert/VuesticAlert.vue'
import Breadcrumbs from './vuestic-components/vuestic-breadcrumbs/VuesticBreadcrumbs.vue'
import Chart from './vuestic-components/vuestic-chart/VuesticChart.vue'
import Chat from './vuestic-components/vuestic-chat/VuesticChat.vue'
import Checkbox from './vuestic-components/vuestic-checkbox/VuesticCheckbox.vue'
import DataTable from './vuestic-components/vuestic-datatable/VuesticDataTable.vue'
import Feed from './vuestic-components/vuestic-feed/VuesticFeed.vue'
import Modal from './vuestic-components/vuestic-modal/VuesticModal.vue'
Expand Down Expand Up @@ -31,6 +32,7 @@ const VuesticPlugin = {
Vue.component(Breadcrumbs.name, Breadcrumbs)
Vue.component(Chart.name, Chart)
Vue.component(Chat.name, Chat)
Vue.component(Checkbox.name, Checkbox)
Vue.component(DataTable.name, DataTable)
Vue.component(Feed.name, Feed)
Vue.component(Modal.name, Modal)
Expand Down

0 comments on commit 4c8053d

Please sign in to comment.