main
vue 69 lines 1.42 KB
Raw
1 <template>
2 <n-card :class="{ hovered }">
3 <div class="flex h-full items-center overflow-hidden">
4 <div class="card-wrap flex gap-4" :class="{ 'flex-col items-center text-center': vertical }">
5 <div class="icon flex flex-col justify-center">
6 <slot name="icon"></slot>
7 </div>
8 <div class="info flex grow flex-col overflow-hidden">
9 <div class="title flex items-center gap-2">
10 {{ title }}
11 <Icon v-if="hovered" :name="ArrowRightIcon" :size="12" />
12 </div>
13 <div v-if="value" class="value mt-1">
14 {{ value }}
15 </div>
16 </div>
17 </div>
18 </div>
19 </n-card>
20 </template>
21
22 <script setup lang="ts">
23 import { NCard } from "naive-ui"
24 import { toRefs } from "vue"
25 import Icon from "@/components/common/Icon.vue"
26
27 const props = defineProps<{
28 title: string
29 value?: number | string
30 vertical?: boolean
31 hovered?: boolean
32 }>()
33 const { title, value, vertical, hovered } = toRefs(props)
34
35 const ArrowRightIcon = "carbon:arrow-right"
36 </script>
37
38 <style scoped lang="scss">
39 .n-card {
40 overflow: hidden;
41
42 .card-wrap {
43 width: 100%;
44 overflow: hidden;
45
46 .title {
47 font-size: 16px;
48 text-overflow: ellipsis;
49 white-space: nowrap;
50 overflow: hidden;
51 }
52
53 .value {
54 font-family: var(--font-family-display);
55 font-size: 22px;
56 font-weight: bold;
57 text-overflow: ellipsis;
58 white-space: nowrap;
59 overflow: hidden;
60 }
61 }
62
63 &.hovered {
64 &:hover {
65 border-color: var(--primary-color);
66 }
67 }
68 }
69 </style>