Enhancement: button component (#1932)

This commit is contained in:
Sivin Varghese
2021-03-26 20:20:20 +05:30
committed by GitHub
parent ff69ef7317
commit a246989551
2 changed files with 63 additions and 0 deletions

View File

@@ -0,0 +1,61 @@
<template>
<button
class="button"
:class="[
variant,
size,
colorScheme,
classNames,
isDisabled ? 'disabled' : '',
]"
:disabled="isDisabled || isLoading"
@click="handleClick"
>
<spinner v-if="isLoading" size="small" />
<i v-if="icon" :class="icon"></i>
<span v-if="$slots.default"><slot></slot></span>
</button>
</template>
<script>
import Spinner from 'shared/components/Spinner.vue';
export default {
name: 'WootButton',
components: { Spinner },
props: {
variant: {
type: String,
default: '',
},
size: {
type: String,
default: '',
},
icon: {
type: String,
default: '',
},
colorScheme: {
type: String,
default: 'primary',
},
classNames: {
type: String,
default: '',
},
isDisabled: {
type: Boolean,
default: false,
},
isLoading: {
type: Boolean,
default: false,
},
},
methods: {
handleClick(evt) {
this.$emit('click', evt);
},
},
};
</script>