2
0
mirror of https://github.com/frappe/books.git synced 2025-02-11 08:28:47 +00:00
books/src/components/Button.vue

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

65 lines
1.2 KiB
Vue
Raw Normal View History

2019-10-04 23:51:26 +05:30
<template>
<button
class="
focus:outline-none
rounded-md
flex
justify-center
items-center
text-sm
"
:class="_class"
v-bind="$attrs"
>
2019-10-04 23:51:26 +05:30
<slot></slot>
</button>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
export default defineComponent({
2019-10-05 01:48:10 +05:30
name: 'Button',
props: {
type: {
type: String,
default: 'secondary',
},
icon: {
type: Boolean,
default: false,
},
disabled: {
type: Boolean,
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: {
_class() {
return {
'opacity-50 cursor-not-allowed pointer-events-none': this.disabled,
'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,
'px-3': this.padding && this.icon,
'px-6': this.padding && !this.icon,
};
},
},
});
2019-10-05 01:48:10 +05:30
</script>
<style scoped>
button:focus {
filter: brightness(0.95);
}
</style>