mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-02 12:08:01 +00:00
Enhancement: button component (#1932)
This commit is contained in:
61
app/javascript/dashboard/components/ui/WootButton.vue
Normal file
61
app/javascript/dashboard/components/ui/WootButton.vue
Normal 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>
|
||||||
@@ -12,6 +12,7 @@ import hljs from 'highlight.js';
|
|||||||
import Multiselect from 'vue-multiselect';
|
import Multiselect from 'vue-multiselect';
|
||||||
import WootSwitch from 'components/ui/Switch';
|
import WootSwitch from 'components/ui/Switch';
|
||||||
import WootWizard from 'components/ui/Wizard';
|
import WootWizard from 'components/ui/Wizard';
|
||||||
|
import WootButton from 'components/ui/WootButton';
|
||||||
import { sync } from 'vuex-router-sync';
|
import { sync } from 'vuex-router-sync';
|
||||||
import Vuelidate from 'vuelidate';
|
import Vuelidate from 'vuelidate';
|
||||||
import VTooltip from 'v-tooltip';
|
import VTooltip from 'v-tooltip';
|
||||||
@@ -48,6 +49,7 @@ Vue.use(hljs.vuePlugin);
|
|||||||
Vue.component('multiselect', Multiselect);
|
Vue.component('multiselect', Multiselect);
|
||||||
Vue.component('woot-switch', WootSwitch);
|
Vue.component('woot-switch', WootSwitch);
|
||||||
Vue.component('woot-wizard', WootWizard);
|
Vue.component('woot-wizard', WootWizard);
|
||||||
|
Vue.component('woot-button', WootButton);
|
||||||
|
|
||||||
const i18nConfig = new VueI18n({
|
const i18nConfig = new VueI18n({
|
||||||
locale: 'en',
|
locale: 'en',
|
||||||
|
|||||||
Reference in New Issue
Block a user