| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <template>
- <q-card class="stat-card">
- <div class="flex justify-between items-start no-wrap">
- <span class="text-subtitle2 text-dark">{{ title }}</span>
- <q-icon :name="icon" size="22px" color="dark" />
- </div>
- <div class="value-area">
- <span class="text-h5 text-primary value-text">{{ value }}</span>
- <q-badge
- v-if="badge"
- :color="badgeColor"
- :label="badge"
- :style="customStyle"
- class="stat-badge"
- />
- <span v-else-if="subtitle" class="text-caption text-foreground">{{
- subtitle
- }}</span>
- </div>
- </q-card>
- </template>
- <script setup>
- defineProps({
- title: { type: String, required: true },
- icon: { type: String, default: "mdi-information-outline" },
- value: { type: [String, Number], required: true },
- subtitle: { type: String, default: "" },
- badge: { type: String, default: "" },
- badgeColor: { type: String, default: "accent-1" },
- customStyle: { type: String, default: "padding: 4px" },
- });
- </script>
- <style scoped lang="scss">
- .stat-card {
- flex: 1 1 0;
- min-width: 0;
- height: 140px;
- border-radius: 12px;
- box-shadow: 0 0 0 1px #c0c0c0c0 !important;
- padding: 16px 20px;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- }
- .value-area {
- display: flex;
- flex-direction: column;
- gap: 4px;
- }
- .value-text {
- font-weight: 600;
- line-height: 1.2;
- }
- .stat-badge {
- font-size: 12px;
- border-radius: 8px;
- width: fit-content;
- color: $primary;
- }
- </style>
|