80 lines
1.2 KiB
Vue
80 lines
1.2 KiB
Vue
<script setup lang="ts">
|
|
import type { Component } from 'vue'
|
|
|
|
defineProps<{
|
|
label: string
|
|
value: string | number
|
|
caption: string
|
|
icon: Component
|
|
tone?: 'neutral' | 'success' | 'warning' | 'danger'
|
|
}>()
|
|
</script>
|
|
|
|
<template>
|
|
<div class="metric-tile" :class="tone || 'neutral'">
|
|
<div class="metric-icon">
|
|
<ElIcon>
|
|
<component :is="icon" />
|
|
</ElIcon>
|
|
</div>
|
|
<div>
|
|
<span>{{ label }}</span>
|
|
<strong>{{ value }}</strong>
|
|
<small>{{ caption }}</small>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.metric-tile {
|
|
display: flex;
|
|
gap: 12px;
|
|
min-height: 108px;
|
|
padding: 16px;
|
|
border: 1px solid #e3e8f2;
|
|
border-radius: 8px;
|
|
background: #ffffff;
|
|
}
|
|
|
|
.metric-icon {
|
|
display: grid;
|
|
flex: 0 0 38px;
|
|
width: 38px;
|
|
height: 38px;
|
|
place-items: center;
|
|
border-radius: 8px;
|
|
background: #edf4ff;
|
|
color: #1d5fd0;
|
|
}
|
|
|
|
span,
|
|
small {
|
|
display: block;
|
|
color: #748093;
|
|
font-size: 12px;
|
|
}
|
|
|
|
strong {
|
|
display: block;
|
|
margin: 7px 0 5px;
|
|
color: #111827;
|
|
font-size: 24px;
|
|
line-height: 1;
|
|
}
|
|
|
|
.success .metric-icon {
|
|
background: #e9f8f0;
|
|
color: #16844a;
|
|
}
|
|
|
|
.warning .metric-icon {
|
|
background: #fff6df;
|
|
color: #a96f00;
|
|
}
|
|
|
|
.danger .metric-icon {
|
|
background: #fff0f0;
|
|
color: #bc3434;
|
|
}
|
|
</style>
|