2024-04-05 17:35:14 +07:00
|
|
|
<script setup lang="ts">
|
|
|
|
|
import AppBox from 'components/app/AppBox.vue';
|
|
|
|
|
|
2024-04-22 14:19:35 +07:00
|
|
|
const props = withDefaults(
|
|
|
|
|
defineProps<{
|
|
|
|
|
branch: {
|
2024-07-03 14:12:51 +07:00
|
|
|
icon: string;
|
2024-04-22 14:19:35 +07:00
|
|
|
count: number;
|
|
|
|
|
label: string;
|
2024-06-12 15:34:09 +07:00
|
|
|
color: 'pink' | 'purple' | 'green' | 'orange';
|
2024-04-22 14:19:35 +07:00
|
|
|
}[];
|
|
|
|
|
dark?: boolean;
|
2024-04-23 14:43:00 +07:00
|
|
|
labelI18n?: boolean;
|
2024-07-03 09:21:53 +00:00
|
|
|
nowrap?: boolean;
|
2024-04-22 14:19:35 +07:00
|
|
|
}>(),
|
|
|
|
|
{
|
2024-04-23 14:43:00 +07:00
|
|
|
labelI18n: false,
|
2024-04-22 14:19:35 +07:00
|
|
|
},
|
|
|
|
|
);
|
2024-04-05 17:35:14 +07:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<div
|
2024-07-04 11:00:03 +07:00
|
|
|
class="row"
|
2024-04-05 17:35:14 +07:00
|
|
|
style="gap: var(--size-4)"
|
2024-07-04 04:14:41 +00:00
|
|
|
:class="{ dark, 'no-wrap': nowrap }"
|
2024-04-05 17:35:14 +07:00
|
|
|
>
|
2024-04-10 20:43:58 +07:00
|
|
|
<AppBox
|
2024-04-23 14:20:08 +07:00
|
|
|
v-for="v in props.branch"
|
2024-07-04 11:00:03 +07:00
|
|
|
class="no-padding shadow-2"
|
2024-04-23 14:20:08 +07:00
|
|
|
:class="{ [`stat-card__${v.color}`]: true }"
|
2024-07-04 11:00:03 +07:00
|
|
|
:key="v.label"
|
2024-04-05 17:35:14 +07:00
|
|
|
>
|
2024-07-04 11:00:03 +07:00
|
|
|
<div class="stat-card__content row items-center q-px-md q-py-sm">
|
2024-07-03 14:12:51 +07:00
|
|
|
<div class="col-4 text-center">
|
|
|
|
|
<q-avatar
|
|
|
|
|
size="lg"
|
|
|
|
|
style="background-color: hsla(0 0% 100% /0.15)"
|
|
|
|
|
text-color="white"
|
|
|
|
|
:icon="v.icon"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-6 justify-center column">
|
|
|
|
|
<div class="col-6 ellipsis text-bold" style="width: 100%">
|
|
|
|
|
{{ labelI18n ? $t(v.label) : v.label }}
|
|
|
|
|
<q-tooltip
|
|
|
|
|
anchor="top middle"
|
|
|
|
|
self="bottom middle"
|
|
|
|
|
:offset="[10, 10]"
|
|
|
|
|
>
|
|
|
|
|
{{ labelI18n ? $t(v.label) : v.label }}
|
|
|
|
|
</q-tooltip>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="col-6">{{ v.count }}</div>
|
2024-04-22 14:19:35 +07:00
|
|
|
</div>
|
2024-04-05 17:35:14 +07:00
|
|
|
</div>
|
2024-04-10 20:43:58 +07:00
|
|
|
</AppBox>
|
2024-04-05 17:35:14 +07:00
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
2024-04-23 14:20:08 +07:00
|
|
|
.stat-card {
|
|
|
|
|
--_color: var(--gray-6);
|
2024-06-25 17:25:33 +07:00
|
|
|
display: grid;
|
|
|
|
|
grid-template-columns: repeat(2, 1fr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@media screen and (min-width: 1024px) {
|
|
|
|
|
.stat-card {
|
|
|
|
|
display: flex;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@media screen and (min-width: 1920px) {
|
|
|
|
|
.stat-card {
|
|
|
|
|
display: flex;
|
|
|
|
|
}
|
2024-04-23 14:20:08 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.stat-card__content {
|
2024-04-05 17:35:14 +07:00
|
|
|
z-index: 2;
|
2024-07-03 14:12:51 +07:00
|
|
|
color: hsla(var(--gray-0-hsl) / 1);
|
|
|
|
|
background: hsla(var(--_color) / 1);
|
2024-04-05 17:35:14 +07:00
|
|
|
height: 100%;
|
2024-07-03 14:16:33 +07:00
|
|
|
min-width: 200px;
|
2024-04-05 17:35:14 +07:00
|
|
|
}
|
|
|
|
|
|
2024-04-23 14:20:08 +07:00
|
|
|
.stat-card__purple {
|
2024-07-03 14:12:51 +07:00
|
|
|
--_color: var(--violet-11-hsl);
|
2024-04-05 17:35:14 +07:00
|
|
|
}
|
|
|
|
|
|
2024-04-23 14:20:08 +07:00
|
|
|
.stat-card__pink {
|
2024-07-03 14:12:51 +07:00
|
|
|
--_color: var(--pink-6-hsl);
|
2024-04-05 17:35:14 +07:00
|
|
|
}
|
2024-04-11 09:43:09 +07:00
|
|
|
|
2024-04-23 14:20:08 +07:00
|
|
|
.stat-card__green {
|
2024-07-03 14:12:51 +07:00
|
|
|
--_color: var(--teal-10-hsl);
|
2024-04-23 13:03:12 +07:00
|
|
|
}
|
|
|
|
|
|
2024-06-12 15:34:09 +07:00
|
|
|
.stat-card__orange {
|
2024-07-03 14:12:51 +07:00
|
|
|
--_color: var(--orange-5-hsl);
|
2024-06-12 15:34:09 +07:00
|
|
|
}
|
|
|
|
|
|
2024-04-23 14:20:08 +07:00
|
|
|
.dark .stat-card__purple {
|
2024-07-03 14:12:51 +07:00
|
|
|
--_color: var(--violet-10-hsl);
|
2024-04-11 09:43:09 +07:00
|
|
|
}
|
2024-04-23 13:03:12 +07:00
|
|
|
|
2024-04-23 14:20:08 +07:00
|
|
|
.dark .stat-card__green {
|
2024-07-03 14:12:51 +07:00
|
|
|
--_color: var(--teal-8-hsl);
|
2024-04-23 13:03:12 +07:00
|
|
|
}
|
2024-06-12 15:34:09 +07:00
|
|
|
|
|
|
|
|
.dark .stat-card__orange {
|
|
|
|
|
--_color: var(--orange-8);
|
|
|
|
|
}
|
2024-04-05 17:35:14 +07:00
|
|
|
</style>
|