mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-11-03 20:48:07 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			78 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
			
		
		
	
	
			78 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
<template>
 | 
						|
  <button
 | 
						|
    class="button"
 | 
						|
    :class="buttonClasses"
 | 
						|
    :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>
 | 
						|
  </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,
 | 
						|
    },
 | 
						|
    isExpanded: {
 | 
						|
      type: Boolean,
 | 
						|
      default: false,
 | 
						|
    },
 | 
						|
  },
 | 
						|
  computed: {
 | 
						|
    variantClasses() {
 | 
						|
      if (this.variant.includes('link')) {
 | 
						|
        return `clear ${this.variant}`;
 | 
						|
      }
 | 
						|
      return this.variant;
 | 
						|
    },
 | 
						|
    buttonClasses() {
 | 
						|
      return [
 | 
						|
        this.variantClasses,
 | 
						|
        this.size,
 | 
						|
        this.colorScheme,
 | 
						|
        this.classNames,
 | 
						|
        this.isDisabled ? 'disabled' : '',
 | 
						|
        this.isExpanded ? 'expanded' : '',
 | 
						|
      ];
 | 
						|
    },
 | 
						|
  },
 | 
						|
  methods: {
 | 
						|
    handleClick(evt) {
 | 
						|
      this.$emit('click', evt);
 | 
						|
    },
 | 
						|
  },
 | 
						|
};
 | 
						|
</script>
 |