Skip to content

Commit b1d84c7

Browse files
committed
feat: refactor Button and add secondary style
1 parent 727d213 commit b1d84c7

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

src/components/ui/Button.vue

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,36 @@
22
<component
33
:is="as || 'button'"
44
:type="as === 'button' || !as ? 'button' : undefined"
5-
class="inline-flex h-11 cursor-pointer gap-1.5 items-center justify-center rounded-lg border-none bg-primary! px-5! py-2 text-base font-medium text-[#1e1e1e]! no-underline! transition-all! duration-200 not-disabled:hover:-translate-y-0.5 not-disabled:hover:transform not-disabled: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"
5+
:class="buttonClasses"
66
v-bind="$attrs"
77
>
88
<slot />
99
</component>
1010
</template>
1111

1212
<script setup>
13-
defineProps({
13+
import { computed } from 'vue';
14+
15+
const props = defineProps({
1416
as: {
1517
type: String,
1618
default: 'button',
1719
},
20+
variant: {
21+
type: String,
22+
default: 'primary',
23+
validator: (value) => ['primary', 'secondary'].includes(value)
24+
}
25+
});
26+
27+
const buttonClasses = computed(() => {
28+
const baseClasses = 'inline-flex h-11 cursor-pointer gap-1.5 items-center justify-center rounded-lg px-5! py-2 text-base font-medium no-underline! transition-all! duration-200 not-disabled:hover:-translate-y-0.5 not-disabled:hover:transform not-disabled:hover:shadow-md focus:outline-none disabled:cursor-not-allowed disabled:opacity-60';
29+
30+
if (props.variant === 'secondary') {
31+
return `${baseClasses} bg-soft-bg! text-text1! border border-primary! hover:!bg-primary/10 focus:shadow-[0_0_0_2px_rgba(252,209,90,0.3)]`;
32+
}
33+
34+
// Primary variant (default)
35+
return `${baseClasses} border-none bg-primary! text-[#1e1e1e]! focus:shadow-[0_0_0_2px_rgba(252,209,90,0.3)]`;
1836
});
1937
</script>

0 commit comments

Comments
 (0)