main
vue 21 lines 695 Bytes
Raw
1 <template>
2 <Icon :name="getLevelIcon(level)" :size />
3 </template>
4
5 <script setup lang="ts">
6 import Icon from "@/components/common/Icon.vue"
7 import { ScaComplianceLevel } from "@/types/sca.d"
8
9 const { level, size } = defineProps<{ level: ScaComplianceLevel; size?: number }>()
10
11 function getLevelIcon(level: string): string {
12 const iconMap: Record<string, string> = {
13 [ScaComplianceLevel.Excellent]: "carbon:checkmark-filled",
14 [ScaComplianceLevel.Good]: "carbon:checkmark",
15 [ScaComplianceLevel.Average]: "carbon:warning",
16 [ScaComplianceLevel.Poor]: "carbon:warning-alt",
17 [ScaComplianceLevel.Critical]: "carbon:warning-hex-filled"
18 }
19 return iconMap[level] || "carbon:help"
20 }
21 </script>