2021-03-26 14:50:20 +00:00
|
|
|
<template>
|
|
|
|
<button
|
|
|
|
class="button"
|
|
|
|
:class="[
|
|
|
|
variant,
|
|
|
|
size,
|
|
|
|
colorScheme,
|
|
|
|
classNames,
|
|
|
|
isDisabled ? 'disabled' : '',
|
|
|
|
]"
|
|
|
|
:disabled="isDisabled || isLoading"
|
|
|
|
@click="handleClick"
|
|
|
|
>
|
|
|
|
<spinner v-if="isLoading" size="small" />
|
2021-04-07 06:13:16 +00:00
|
|
|
<i v-else-if="icon" class="icon" :class="icon"></i>
|
2021-04-16 15:01:07 +00:00
|
|
|
<span v-if="$slots.default" class="button__content"><slot></slot></span>
|
2021-03-26 14:50:20 +00:00
|
|
|
</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>
|
2021-04-07 06:13:16 +00:00
|
|
|
<style lang="scss" scoped>
|
|
|
|
.button {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
2021-04-16 15:01:07 +00:00
|
|
|
|
|
|
|
&.link {
|
|
|
|
padding: 0;
|
|
|
|
margin: 0;
|
|
|
|
}
|
2021-04-07 06:13:16 +00:00
|
|
|
}
|
|
|
|
.spinner {
|
|
|
|
padding: 0 var(--space-small);
|
|
|
|
}
|
2021-04-16 15:01:07 +00:00
|
|
|
.icon + .button__content {
|
2021-04-07 06:13:16 +00:00
|
|
|
padding-left: var(--space-small);
|
|
|
|
}
|
|
|
|
</style>
|