refactor: stat card color

This commit is contained in:
Methapon2001 2024-04-23 14:20:08 +07:00
parent b043ce6c17
commit 5e12bba2af

View file

@ -15,21 +15,19 @@ const props = withDefaults(
isBranch: false, isBranch: false,
}, },
); );
const colorRotate = ['pink', 'purple'];
</script> </script>
<template> <template>
<div <div
class="row" class="stat-card row"
style="gap: var(--size-4)" style="gap: var(--size-4)"
:class="{ 'justify-between': $q.screen.lt.md, dark }" :class="{ 'justify-between': $q.screen.lt.md, dark }"
> >
<AppBox <AppBox
v-for="(v, i) in props.branch" v-for="v in props.branch"
:key="v.label" :key="v.label"
class="bordered wave col-12" class="bordered stat-card__wave col-12"
:class="{ [`stat__${v.color || colorRotate[i % 2]}`]: true }" :class="{ [`stat-card__${v.color}`]: true }"
style="width: 200px; min-width: 150px; box-shadow: var(--shadow-2)" style="width: 200px; min-width: 150px; box-shadow: var(--shadow-2)"
> >
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320">
@ -39,7 +37,7 @@ const colorRotate = ['pink', 'purple'];
></path> ></path>
</svg> </svg>
<div class="stat__content"> <div class="stat-card__content">
<div class="text-h5 text-weight-bold">{{ v.count }}</div> <div class="text-h5 text-weight-bold">{{ v.count }}</div>
<div class="text-weight-bold"> <div class="text-weight-bold">
{{ isBranch ? $t(v.label) : v.label }} {{ isBranch ? $t(v.label) : v.label }}
@ -50,48 +48,52 @@ const colorRotate = ['pink', 'purple'];
</template> </template>
<style scoped> <style scoped>
.wave { .stat-card {
--_color: var(--gray-6);
}
.stat-card__wave {
position: relative; position: relative;
display: flex; display: flex;
& svg {
width: 200px;
position: absolute;
left: 0px;
bottom: 0;
opacity: 0.1;
& .box-path {
fill: var(--_color);
fill-opacity: 1;
}
}
} }
svg { .stat-card__content {
width: 200px;
position: absolute;
left: 0px;
bottom: 0;
opacity: 0.1;
}
.box-path {
fill: var(--_color);
fill-opacity: 1;
}
.stat__content {
z-index: 2; z-index: 2;
color: var(--_color); color: var(--_color);
height: 100%; height: 100%;
width: 200px; width: 200px;
} }
.stat__purple { .stat-card__purple {
--_color: var(--violet-11); --_color: var(--violet-11);
} }
.stat__pink { .stat-card__pink {
--_color: var(--pink-6); --_color: var(--pink-6);
} }
.stat__green { .stat-card__green {
--_color: var(--teal-10); --_color: var(--teal-10);
} }
.dark .stat__purple { .dark .stat-card__purple {
--_color: var(--purple-8); --_color: var(--purple-8);
} }
.dark .stat__green { .dark .stat-card__green {
--_color: var(--teal-8); --_color: var(--teal-8);
} }
</style> </style>