-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathBaseButton.vue
More file actions
35 lines (31 loc) · 1.01 KB
/
BaseButton.vue
File metadata and controls
35 lines (31 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<!-- assets/vue/components/base/BaseButton.vue -->
<template>
<button
:class="buttonClass"
type="button"
v-bind="$attrs"
>
<slot />
</button>
</template>
<script setup>
import { computed } from 'vue'
const props = defineProps({
variant: {
type: String,
default: 'primary', // primary | secondary | ghost
},
})
const buttonClass = computed(() => {
const base = 'inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-offset-2';
switch (props.variant) {
case 'secondary':
return `${base} text-gray-700 bg-white border-gray-300 hover:bg-gray-50 focus:ring-blue-500`;
case 'ghost':
return 'inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md text-blue-600 bg-transparent hover:bg-blue-50 focus:outline-none';
case 'primary':
default:
return `${base} text-white bg-blue-600 hover:bg-blue-700 focus:ring-blue-500`;
}
})
</script>