2024-07-05 12:22:31 +00:00
|
|
|
<template>
|
2024-07-08 10:03:25 +00:00
|
|
|
<button :class="rootClasses" @click="useRipple($event, true)">
|
|
|
|
<div :class="outerClasses">
|
|
|
|
<div :class="innerClasses">
|
|
|
|
<slot></slot>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</button>
|
2024-07-05 12:22:31 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2024-07-08 10:03:25 +00:00
|
|
|
import { computed, ref } from "vue";
|
|
|
|
import type { ButtonProps, PTAttribs } from "./types";
|
|
|
|
import { twMerge } from "tailwind-merge";
|
2024-07-05 12:22:31 +00:00
|
|
|
|
|
|
|
const props = withDefaults(defineProps<ButtonProps>(), {
|
2024-07-08 10:03:25 +00:00
|
|
|
rounded: true,
|
|
|
|
spinerSize: "6",
|
|
|
|
spinerColor: "accent1",
|
|
|
|
spinerPlace: "prefix",
|
2024-07-05 12:22:31 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
const classes = ref({
|
2024-07-08 10:03:25 +00:00
|
|
|
root: {
|
|
|
|
class: `flex justify-center items-center disabled:opacity-60`,
|
|
|
|
},
|
|
|
|
outer: {
|
|
|
|
class: `bg-gradient-to-r from-accent1 to-accent2 p-[2px] w-full focus:outline-none ${
|
|
|
|
props.rounded ? "rounded-3xl" : ""
|
|
|
|
}`,
|
|
|
|
},
|
|
|
|
inner: {
|
|
|
|
class: `justify-center flex items-center bg-white dark:bg-gradient-to-r px-5 py-2 w-full h-full font-semibold leading-[1.5] back ${
|
|
|
|
props.rounded ? "rounded-3xl" : ""
|
|
|
|
}`,
|
|
|
|
},
|
2024-07-05 12:22:31 +00:00
|
|
|
} as PTAttribs);
|
|
|
|
|
2024-07-08 10:03:25 +00:00
|
|
|
const rootClasses = computed(() =>
|
|
|
|
twMerge(classes.value.root?.class, props.pt?.root?.class)
|
|
|
|
);
|
|
|
|
const innerClasses = computed(() =>
|
|
|
|
twMerge(classes.value.inner?.class, props.pt?.inner?.class)
|
|
|
|
);
|
|
|
|
const outerClasses = computed(() =>
|
|
|
|
twMerge(classes.value.outer?.class, props.pt?.outer?.class)
|
|
|
|
);
|
2024-07-05 12:22:31 +00:00
|
|
|
</script>
|