Newer
Older
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
<template>
<component
:is="to ? 'nuxt-link' : 'div'"
:to="to"
class="block rounded p-4"
:class="computedClass"
>
<slot />
</component>
</template>
<script>
export default {
name: 'Box',
props: {
to: {
type: [String, Object],
default: null,
},
color: {
type: String,
default: null,
},
},
computed: {
computedClass() {
let classes = ''
if (this.color) {
classes += `bg-${this.color}-100 dark:bg-${this.color}-900`
} else {
classes = `border dark:border-gray-700`
}
if (this.to)
classes +=
' transition transform hover:shadow-xl hover:-translate-y-0.5 is-box-with-link'
return classes
},
},
}
</script>
<style lang="postcss" scoped>
.is-box-with-link {
text-decoration: none !important;
color: currentColor !important;
font-weight: normal !important;
}
</style>