DataSectionItem.vue
1.17 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<template>
<VaCard>
<VaCardContent>
<section>
<header class="flex items-center justify-between">
<div class="text-lg font-semibold grow">{{ value }}</div>
<div
class="p-1 rounded"
:style="{
backgroundColor: iconBackground,
color: iconColor,
}"
>
<slot name="icon"></slot>
</div>
</header>
<div>
<p class="mb-2">{{ title }}</p>
<p class="text-xs text-secondary">
<span :class="changeClass">
<template v-if="up">↑</template>
<template v-else>↓</template>
{{ changeText }}
</span>
since last month
</p>
</div>
</section>
</VaCardContent>
</VaCard>
</template>
<script lang="ts" setup>
import { computed } from 'vue'
import { VaCard } from 'vuestic-ui'
const props = defineProps<{
title: string
value: string | number
changeText: string
up: boolean
iconBackground: string
iconColor: string
}>()
const changeClass = computed(() => ({
'text-success': props.up,
'text-red-600': !props.up,
}))
</script>