Skip to content

Commit

Permalink
refactor(components): remove unused default props
Browse files Browse the repository at this point in the history
  • Loading branch information
devCrossNet committed Dec 30, 2018
1 parent 62569a6 commit 270759e
Show file tree
Hide file tree
Showing 21 changed files with 45 additions and 92 deletions.
1 change: 0 additions & 1 deletion src/app/shared/components/VueBadge/VueBadge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export default {
},
outlined: {
type: Boolean,
default: false,
},
},
computed: {
Expand Down
14 changes: 5 additions & 9 deletions src/app/shared/components/VueButton/VueButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,15 @@ export default {
},
disabled: {
type: Boolean,
default: false,
},
loading: {
type: Boolean,
default: false,
},
outlined: {
type: Boolean,
default: false,
},
ghost: {
type: Boolean,
default: false,
},
},
components: {
Expand All @@ -38,28 +34,28 @@ export default {
cssClasses() {
const classes = [this.$style.button, this.$style.ripple];
if (this.outlined === true || this.ghost) {
if (this.outlined || this.ghost) {
classes.push(this.$style.outlined);
}
if (this.ghost === true) {
if (this.ghost) {
classes.push(this.$style.ghost);
}
if (this.color) {
classes.push(this.$style[this.color]);
}
if (this.disabled === true || this.loading === true) {
if (this.disabled || this.loading) {
classes.push(this.$style.disabled);
}
return classes;
},
actualWidth() {
return this.loading === true && this.$refs.button ? `${this.$refs.button.getBoundingClientRect().width}px` : null;
return this.loading && this.$refs.button ? `${this.$refs.button.getBoundingClientRect().width}px` : null;
},
},
methods: {
click(e: Event) {
if (this.disabled === false && this.loading === false) {
if (!this.disabled && !this.loading) {
this.$emit('click', e);
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,12 @@ export default {
props: {
title: {
type: String,
default: '',
},
subtitle: {
type: String,
default: '',
},
image: {
type: String,
default: '',
},
},
computed: {
Expand Down
9 changes: 2 additions & 7 deletions src/app/shared/components/VueCheckbox/VueCheckbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,21 @@ export default {
},
checked: {
type: Boolean,
default: false,
},
value: {
type: Boolean,
default: false,
},
disabled: {
type: Boolean,
default: false,
},
required: {
type: Boolean,
default: false,
},
validation: {
default: '',
type: String,
},
radio: {
type: Boolean,
default: false,
},
label: {
type: String,
Expand Down Expand Up @@ -92,7 +87,7 @@ export default {
onClick(e: Event) {
e.preventDefault();
if (this.disabled === false) {
if (!this.disabled) {
this.$emit('click', e);
this.$emit('input', !Boolean(this.value));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ story.add(
'Default',
withInfo({})(() => ({
components: { VueDatePicker },
template: `<vue-date-picker @change="action" :first-day-of-week="1" placeholder="Select a date" />`,
template: `<vue-date-picker name="date" id="date" @change="action" :first-day-of-week="1" placeholder="Select a date" />`,
i18n,
methods: {
action: action('@change'),
Expand Down
15 changes: 5 additions & 10 deletions src/app/shared/components/VueDatePicker/VueDatePicker.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div :class="$style.vueDatePicker" @click="show = true;">
<div :class="$style.vueDatePicker" @click="show = true">
<vue-input
:name="name"
:id="id"
Expand All @@ -11,7 +11,7 @@
:message="message"
@focus="onFocus"
/>
<vue-modal :show="show" :fit-content="true" @close="show = false;">
<vue-modal :show="show" :fit-content="true" @close="show = false">
<vue-calendar
:min-date="minDate"
:max-date="maxDate"
Expand All @@ -20,7 +20,7 @@
:selected-date="date"
:start-date="startDate"
:end-date="endDate"
@close="show = false;"
@close="show = false"
@change="onChange"
>
</vue-calendar>
Expand All @@ -43,11 +43,11 @@ export default {
props: {
name: {
type: String,
default: 'date',
required: true,
},
id: {
type: String,
default: 'date',
required: true,
},
minDate: {
type: Date,
Expand All @@ -61,7 +61,6 @@ export default {
},
placeholder: {
type: String,
default: '',
},
startDate: {
type: Date,
Expand All @@ -74,19 +73,15 @@ export default {
},
required: {
type: Boolean,
default: false,
},
disabled: {
type: Boolean,
default: false,
},
readonly: {
type: Boolean,
default: true,
},
message: {
type: String,
default: '',
},
},
data(): any {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,9 @@ export default {
},
placeholderStart: {
type: String,
default: '',
},
placeholderEnd: {
type: String,
default: '',
},
},
data(): any {
Expand All @@ -77,6 +75,5 @@ export default {

<style lang="scss" module>
.vueDateRangePicker {
display: block;
}
</style>
4 changes: 1 addition & 3 deletions src/app/shared/components/VueDonutChart/VueDonutChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,13 @@ export default {
props: {
title: {
type: String,
default: '',
},
data: {
type: Array,
default: [],
required: true,
},
unit: {
type: String,
default: '',
},
strokeWidth: {
type: Number,
Expand Down
2 changes: 1 addition & 1 deletion src/app/shared/components/VueInput/VueInput.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ story.add(
<vue-modal :show="show" @close="show = false">
<vue-input autofocus placeholder="Name" name="name" id="name" v-model="model" />
<vue-button @click="show = !show">Close</vue-button>
<vue-button color="primary" ghost @click="show = !show">Close</vue-button>
</vue-modal>
</div>`,
})),
Expand Down
10 changes: 1 addition & 9 deletions src/app/shared/components/VueInput/VueInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,42 +44,34 @@ export default {
},
placeholder: {
type: String,
default: '',
},
required: {
type: Boolean,
default: false,
},
autofocus: {
type: Boolean,
default: false,
},
value: {
type: String,
default: '',
},
type: {
type: String,
default: 'text',
},
disabled: {
type: Boolean,
default: false,
},
readonly: {
type: Boolean,
default: false,
},
message: {
type: String,
default: '',
},
errorMessage: {
type: String,
default: '',
},
validation: {
default: '',
type: String,
},
autocomplete: {
default: 'off',
Expand Down
2 changes: 0 additions & 2 deletions src/app/shared/components/VueLoader/VueLoader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@ export default {
props: {
medium: {
type: Boolean,
default: false,
},
large: {
type: Boolean,
default: false,
},
color: {
type: String,
Expand Down
6 changes: 3 additions & 3 deletions src/app/shared/components/VueModal/VueModal.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<template>
<transition @beforeEnter="beforeEnter" @enter="enter" @beforeLeave="beforeLeave" @leave="leave">
<div :class="[$style.vueModal, fitContent ? $style.fitContent : '']" v-if="show" ref="modal"><slot /></div>
<div :class="[$style.vueModal, fitContent ? $style.fitContent : '']" v-if="show" :aria-modal="show" ref="modal">
<slot />
</div>
</transition>
</template>

Expand All @@ -11,12 +13,10 @@ export default {
name: 'VueModal',
props: {
show: {
default: false,
type: Boolean,
},
fitContent: {
type: Boolean,
default: false,
},
},
methods: {
Expand Down
6 changes: 0 additions & 6 deletions src/app/shared/components/VueNavBar/VueNavBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@
<script lang="ts">
export default {
name: 'VueNavBar',
components: {},
data() {
return {};
},
props: {},
computed: {},
};
</script>

Expand Down
8 changes: 2 additions & 6 deletions src/app/shared/components/VueSelect/VueSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
{{ option.label }}
</option>
</select>
<i :class="$style.icon" v-if="multiple === false" />
<i :class="$style.icon" v-if="!multiple" />
</div>
</template>

Expand Down Expand Up @@ -55,26 +55,22 @@ export default {
default: '',
},
multiple: {
default: false,
type: Boolean,
},
required: {
default: false,
type: Boolean,
},
disabled: {
default: false,
type: Boolean,
},
validation: {
default: '',
type: String,
},
autocomplete: {
default: 'off',
},
placeholder: {
type: String,
default: '',
},
},
computed: {
Expand Down
4 changes: 1 addition & 3 deletions src/app/shared/components/VueSidebar/VueSidebar.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<aside ref="sidebar">
<button :class="hamburgerCssClasses" type="button" aria-label="menu" @click="open = !open;">
<button :class="hamburgerCssClasses" type="button" aria-label="menu" @click="open = !open">
<span :class="$style.box"> <span :class="$style.inner" /> </span>
</button>
<div :class="sidebarClasses"><slot /></div>
Expand All @@ -10,8 +10,6 @@
<script lang="ts">
export default {
name: 'VueSidebar',
components: {},
props: {},
data(): any {
return {
open: false,
Expand Down
Loading

0 comments on commit 270759e

Please sign in to comment.