Chatwoot/app/javascript/dashboard/components/ui/WootButton.vue

79 lines
1.3 KiB
Vue
Raw Normal View History

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" />
<i v-else-if="icon" class="icon" :class="icon"></i>
<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>
<style lang="scss" scoped>
.button {
display: flex;
align-items: center;
&.link {
padding: 0;
margin: 0;
}
}
.spinner {
padding: 0 var(--space-small);
}
.icon + .button__content {
padding-left: var(--space-small);
}
</style>