main
vue 44 lines 1.07 KB
Raw
1 <template>
2 <span class="index-icon" :class="[`health-${health}`, { color }]">
3 <Icon v-if="health === IndexHealth.GREEN" :name="ShieldIcon" :size="18" />
4 <Icon v-if="health === IndexHealth.YELLOW" :name="WarningIcon" :size="18" />
5 <Icon v-if="health === IndexHealth.RED" :name="DangerIcon" :size="18" />
6 </span>
7 </template>
8
9 <script setup lang="ts">
10 import type { IndexStats } from "@/types/indices.d"
11 import { toRefs } from "vue"
12 import Icon from "@/components/common/Icon.vue"
13 import { IndexHealth } from "@/types/indices.d"
14
15 const props = defineProps<{
16 health: IndexStats["health"]
17 color?: boolean
18 }>()
19 const ShieldIcon = "majesticons:shield-check-line"
20 const WarningIcon = "majesticons:shield-exclamation-line"
21 const DangerIcon = "majesticons:exclamation-line"
22
23 const { health, color } = toRefs(props)
24 </script>
25
26 <style lang="scss" scoped>
27 .index-icon {
28 display: flex;
29 align-items: center;
30 &.color {
31 &.health-green {
32 color: var(--success-color);
33 }
34
35 &.health-yellow {
36 color: var(--warning-color);
37 }
38
39 &.health-red {
40 color: var(--error-color);
41 }
42 }
43 }
44 </style>