CardStatisticsHorizontal.vue
1.68 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<script setup>
import { kFormatter } from '@core/utils/formatters'
const props = defineProps({
title: {
type: String,
required: true,
},
color: {
type: String,
required: false,
default: 'primary',
},
icon: {
type: String,
required: true,
},
stats: {
type: Number,
required: true,
},
change: {
type: Number,
required: true,
},
})
const isPositive = computed(() => Math.sign(props.change) === 1)
</script>
<template>
<VCard
variant="text"
border
>
<VCardText class="d-flex align-center">
<VAvatar
size="40"
rounded
class="elevation-2 me-4"
style="background-color: rgb(var(--v-theme-surface));"
>
<VIcon
:color="props.color"
:icon="props.icon"
:size="24"
/>
</VAvatar>
<div>
<div class="text-body-1">
{{ props.title }}
</div>
<div class="d-flex align-center flex-wrap">
<h5 class="text-h5">
{{ kFormatter(props.stats) }}
</h5>
<div
v-if="props.change"
:class="`${isPositive ? 'text-success' : 'text-error'} mt-1`"
>
<VIcon
:icon="isPositive ? 'ri-arrow-up-s-line' : 'ri-arrow-down-s-line'"
size="24"
/>
<span class="text-base">
{{ Math.abs(props.change) }}%
</span>
</div>
</div>
</div>
</VCardText>
</VCard>
</template>
<style lang="scss">
.skin--bordered {
.v-avatar {
border: 1px solid rgba(var(--v-border-color), var(--v-border-opacity)) !important;
box-shadow: none !important;
}
}
</style>