CardStatisticsWithImages.vue
1.62 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
85
86
87
88
89
<script setup>
const props = defineProps({
title: {
type: String,
required: true,
},
subtitle: {
type: String,
required: true,
},
stats: {
type: String,
required: true,
},
change: {
type: Number,
required: true,
},
image: {
type: String,
required: true,
},
color: {
type: String,
required: false,
default: 'primary',
},
})
const isPositive = computed(() => Math.sign(props.change) === 1)
</script>
<template>
<VCard class="overflow-visible position-relative">
<div class="d-flex">
<VCardText>
<h6 class="text-h6 mb-5">
{{ props.title }}
</h6>
<div class="d-flex align-center flex-wrap mb-3">
<h4 class="text-h4 me-2">
{{ props.stats }}
</h4>
<div
class="text-body-1"
:class="isPositive ? 'text-success' : 'text-error'"
>
{{ isPositive ? `+${props.change}` : props.change }}%
</div>
</div>
<VChip
v-if="props.subtitle"
:color="props.color"
size="small"
>
{{ props.subtitle }}
</VChip>
</VCardText>
<VSpacer />
<div class="illustrator-img">
<VImg
v-if="props.image"
:src="props.image"
:width="110"
/>
</div>
</div>
</VCard>
</template>
<style lang="scss">
.illustrator-img {
position: absolute;
inset-block-end: 0;
inset-inline-end: 5%;
}
@media (max-width: 1200px) and (min-width: 960px) {
.illustrator-img {
inset-block-end: 0;
inset-inline-end: 0;
}
}
</style>