| 1 | <template> |
| 2 | <n-card |
| 3 | size="small" |
| 4 | :class="{ 'group cursor-pointer': clickable }" |
| 5 | :hoverable |
| 6 | content-class="flex items-center gap-4" |
| 7 | > |
| 8 | <div v-if="$slots.icon"> |
| 9 | <slot name="icon" /> |
| 10 | </div> |
| 11 | <div class="flex w-full flex-col gap-2"> |
| 12 | <div class="flex items-center justify-between gap-2"> |
| 13 | <span |
| 14 | class="text-secondary text-sm transition-colors" |
| 15 | :class="{ 'group-hover:text-primary': clickable }" |
| 16 | > |
| 17 | <slot name="title">{{ title }}</slot> |
| 18 | </span> |
| 19 | <Icon |
| 20 | v-if="clickable" |
| 21 | name="carbon:arrow-up-right" |
| 22 | class="group-hover:text-primary transition-colors" |
| 23 | /> |
| 24 | <slot name="header-extra" /> |
| 25 | </div> |
| 26 | <slot /> |
| 27 | <div class="font-mono text-xl font-semibold"> |
| 28 | <slot name="value">{{ value }}</slot> |
| 29 | </div> |
| 30 | <div v-if="subtitle || $slots.subtitle" class="text-secondary text-xs"> |
| 31 | <slot name="subtitle">{{ subtitle }}</slot> |
| 32 | </div> |
| 33 | </div> |
| 34 | </n-card> |
| 35 | </template> |
| 36 | |
| 37 | <script setup lang="ts"> |
| 38 | import { NCard } from "naive-ui" |
| 39 | import Icon from "@/components/common/Icon.vue" |
| 40 | |
| 41 | defineProps<{ |
| 42 | title?: string | number |
| 43 | value?: string | number |
| 44 | subtitle?: string | number |
| 45 | hoverable?: boolean |
| 46 | clickable?: boolean |
| 47 | }>() |
| 48 | </script> |