Skip to content

Commit f018846

Browse files
committed
refactor: replace button element with dynamic component for flexible usage
1 parent d048949 commit f018846

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/components/ui/Button.vue

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
11
<template>
2-
<button
3-
type="button"
4-
class="inline-flex h-11 cursor-pointer items-center justify-center rounded-lg border-none bg-[#fcd15a]! px-5! py-2 text-base font-medium text-[#1e1e1e]! transition-all duration-200 hover:-translate-y-0.5 hover:transform hover:bg-[#ffb74d] hover:shadow-md focus:shadow-[0_0_0_2px_rgba(252,209,90,0.3)] focus:outline-none disabled:cursor-not-allowed disabled:opacity-60"
2+
<component
3+
:is="as || 'button'"
4+
:type="as === 'button' || !as ? 'button' : undefined"
5+
class="inline-flex h-11 cursor-pointer items-center justify-center rounded-lg border-none bg-[#fcd15a]! px-5 py-2 text-base font-medium text-[#1e1e1e]! transition-all! duration-200 hover:-translate-y-0.5 hover:transform hover:bg-[#ffb74d]! hover:shadow-md focus:shadow-[0_0_0_2px_rgba(252,209,90,0.3)] focus:outline-none disabled:cursor-not-allowed disabled:opacity-60 no-underline!"
6+
v-bind="$attrs"
57
>
68
<slot />
7-
</button>
9+
</component>
810
</template>
11+
12+
<script setup>
13+
defineProps({
14+
as: {
15+
type: String,
16+
default: 'button'
17+
}
18+
})
19+
</script>

0 commit comments

Comments
 (0)