2023-04-03 09:08:02 +00:00
|
|
|
<script setup lang="ts">
|
|
|
|
interface Props {
|
2023-04-25 13:02:58 +00:00
|
|
|
title: string;
|
|
|
|
color?: string;
|
|
|
|
icon: string;
|
|
|
|
stats: string;
|
|
|
|
change?: number;
|
|
|
|
subtitle?: string;
|
2023-04-03 09:08:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const props = withDefaults(defineProps<Props>(), {
|
|
|
|
color: 'primary',
|
2023-04-25 13:02:58 +00:00
|
|
|
});
|
2023-04-03 09:08:02 +00:00
|
|
|
|
2023-04-25 13:02:58 +00:00
|
|
|
const isPositive = controlledComputed(
|
|
|
|
() => props.change,
|
|
|
|
() => Math.sign(props.change || 0) === 1
|
|
|
|
);
|
2023-04-03 09:08:02 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2023-04-25 10:27:46 +00:00
|
|
|
<VCard class="h-full flex-col content-between">
|
|
|
|
<VCardText class="d-flex align-center justify-between">
|
2023-04-25 13:02:58 +00:00
|
|
|
<VAvatar v-if="props.icon" rounded size="38" variant="tonal" :color="props.color">
|
|
|
|
<VIcon :icon="props.icon" size="24" />
|
2023-04-03 09:08:02 +00:00
|
|
|
</VAvatar>
|
|
|
|
|
|
|
|
<div
|
|
|
|
v-if="props.change"
|
|
|
|
:class="isPositive ? 'text-success' : 'text-error'"
|
|
|
|
class="d-flex align-center text-sm font-weight-medium mt-n4"
|
|
|
|
>
|
|
|
|
<span>{{ isPositive ? `+${props.change}` : props.change }}%</span>
|
|
|
|
|
|
|
|
<VIcon :icon="isPositive ? 'mdi-chevron-up' : 'mdi-chevron-down'" />
|
|
|
|
</div>
|
|
|
|
</VCardText>
|
|
|
|
|
2023-04-25 10:27:46 +00:00
|
|
|
<VCardText class="d-flex flex-col">
|
2023-04-03 09:08:02 +00:00
|
|
|
<h6 class="text-h6 me-2 mt-2 mb-1">
|
|
|
|
{{ props.stats }}
|
|
|
|
</h6>
|
|
|
|
<p class="text-sm">
|
|
|
|
{{ props.title }}
|
|
|
|
</p>
|
|
|
|
|
2023-04-25 13:02:58 +00:00
|
|
|
<VChip v-if="props.subtitle" size="x-small" class="font-weight-medium">
|
2023-04-03 09:08:02 +00:00
|
|
|
<span class="text-truncate">{{ props.subtitle }}</span>
|
|
|
|
</VChip>
|
|
|
|
</VCardText>
|
|
|
|
</VCard>
|
|
|
|
</template>
|