-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
/
Copy pathLink.vue
52 lines (49 loc) · 964 Bytes
/
Link.vue
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<script setup>
defineProps({
href: {
type: String,
required: true,
},
block: {
type: Boolean,
default: false,
},
size: {
type: String,
default: 'md',
},
type: {
type: String,
default: 'primary',
},
className: {
type: String,
default: '',
},
})
const sizes = {
lg: 'px-5 py-2.5',
md: 'px-4 py-2',
}
const styles = {
outline: 'bg-white border-2 border-black hover:bg-gray-100 text-black',
primary: 'bg-black text-white hover:bg-gray-800 border-2 border-transparent',
inverted: 'bg-white text-black border-2 border-transparent',
muted: 'bg-gray-100 hover:bg-gray-200 border-2 border-transparent',
}
</script>
<template>
<a
:href="href"
class="rounded text-center transition focus-visible:ring-2 ring-offset-2 ring-gray-200"
:class="[
block && 'w-full',
sizes[size],
styles[type],
className,
]"
v-bind="$attrs"
>
<slot />
</a>
</template>