2019-10-04 23:51:26 +05:30
|
|
|
<template>
|
2019-10-13 17:33:01 +05:30
|
|
|
<button
|
2022-06-09 15:40:09 +05:30
|
|
|
class="
|
|
|
|
focus:outline-none
|
|
|
|
rounded-md
|
|
|
|
flex
|
|
|
|
justify-center
|
|
|
|
items-center
|
|
|
|
text-sm
|
|
|
|
"
|
2019-12-16 19:22:14 +05:30
|
|
|
:class="_class"
|
2019-10-13 17:33:01 +05:30
|
|
|
v-bind="$attrs"
|
|
|
|
>
|
2019-10-04 23:51:26 +05:30
|
|
|
<slot></slot>
|
|
|
|
</button>
|
|
|
|
</template>
|
2023-03-21 15:03:13 +05:30
|
|
|
<script lang="ts">
|
|
|
|
import { defineComponent } from 'vue';
|
|
|
|
|
|
|
|
export default defineComponent({
|
2019-10-05 01:48:10 +05:30
|
|
|
name: 'Button',
|
|
|
|
props: {
|
|
|
|
type: {
|
|
|
|
type: String,
|
2022-02-07 16:56:27 +05:30
|
|
|
default: 'secondary',
|
2019-10-14 02:49:28 +05:30
|
|
|
},
|
|
|
|
icon: {
|
|
|
|
type: Boolean,
|
2022-02-07 16:56:27 +05:30
|
|
|
default: false,
|
2019-12-16 19:22:14 +05:30
|
|
|
},
|
|
|
|
disabled: {
|
|
|
|
type: Boolean,
|
2022-02-07 16:56:27 +05:30
|
|
|
default: false,
|
|
|
|
},
|
2022-02-21 16:26:57 +05:30
|
|
|
padding: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true,
|
|
|
|
},
|
2022-07-11 14:15:37 +05:30
|
|
|
background: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true,
|
|
|
|
},
|
2019-10-05 01:48:10 +05:30
|
|
|
},
|
|
|
|
computed: {
|
2019-12-16 19:22:14 +05:30
|
|
|
_class() {
|
|
|
|
return {
|
2022-02-07 16:56:27 +05:30
|
|
|
'opacity-50 cursor-not-allowed pointer-events-none': this.disabled,
|
2022-06-09 15:40:09 +05:30
|
|
|
'text-white': this.type === 'primary',
|
2022-07-11 14:15:37 +05:30
|
|
|
'bg-blue-500': this.type === 'primary' && this.background,
|
2022-07-07 19:00:52 +05:30
|
|
|
'text-gray-700': this.type !== 'primary',
|
2022-07-11 14:15:37 +05:30
|
|
|
'bg-gray-200': this.type !== 'primary' && this.background,
|
|
|
|
'h-8': this.background,
|
2022-06-09 15:40:09 +05:30
|
|
|
'px-3': this.padding && this.icon,
|
|
|
|
'px-6': this.padding && !this.icon,
|
2019-12-16 19:22:14 +05:30
|
|
|
};
|
2022-02-07 16:56:27 +05:30
|
|
|
},
|
|
|
|
},
|
2023-03-21 15:03:13 +05:30
|
|
|
});
|
2019-10-05 01:48:10 +05:30
|
|
|
</script>
|
2022-02-07 16:56:27 +05:30
|
|
|
<style scoped>
|
|
|
|
button:focus {
|
|
|
|
filter: brightness(0.95);
|
|
|
|
}
|
|
|
|
</style>
|