koel/resources/assets/js/components/ui/form/Btn.vue

91 lines
1.4 KiB
Vue
Raw Normal View History

2024-04-04 22:20:42 +00:00
<template>
<button
2024-05-19 05:49:42 +00:00
v-if="tag === 'button'"
2024-04-04 22:20:42 +00:00
ref="button"
class="text-base text-k-text-primary bg-k-primary px-4 py-2.5 rounded cursor-pointer"
type="button"
>
<slot>Click me</slot>
</button>
2024-05-19 05:49:42 +00:00
<a
v-else
ref="button"
class="text-base text-k-text-primary bg-k-primary px-4 py-2.5 rounded cursor-pointer"
>
<slot>Click me</slot>
</a>
2024-04-04 22:20:42 +00:00
</template>
<script lang="ts" setup>
import { ref } from 'vue'
2024-05-19 05:49:42 +00:00
withDefaults(defineProps<{ tag?: 'button' | 'a' }>(), {
tag: 'button'
})
2024-04-04 22:20:42 +00:00
const button = ref<HTMLButtonElement>()
defineExpose({
button
})
</script>
<style lang="postcss" scoped>
2024-05-19 05:49:42 +00:00
button, a {
@apply text-k-text-primary !important;
2024-04-04 22:20:42 +00:00
&:not([disabled]):hover {
box-shadow: inset 0 0 0 10rem rgba(0, 0, 0, .1);
}
&:not([disabled]):active {
box-shadow: inset 0 10px 10px -10px rgba(0, 0, 0, .6);
}
&[big] {
@apply px-6 py-3;
}
&[small] {
@apply text-[0.9rem] px-3 py-1;
}
&[success] {
@apply bg-k-success;
}
&[white] {
@apply bg-transparent text-k-text-secondary;
}
&[danger] {
@apply bg-k-danger;
}
&[grey], &[gray] {
@apply bg-k-bg-secondary;
}
&[highlight] {
@apply bg-k-highlight;
}
&[transparent] {
@apply bg-transparent;
}
2024-05-19 05:49:42 +00:00
2024-04-04 22:20:42 +00:00
&[rounded] {
@apply rounded-full;
}
&[unrounded] {
@apply rounded-none;
}
&[uppercase] {
@apply uppercase;
}
}
</style>