mirror of
https://github.com/khoaliber/dockhand.git
synced 2026-03-02 21:19:05 +00:00
28 lines
853 B
Svelte
28 lines
853 B
Svelte
<script lang="ts">
|
|
import { Badge } from '$lib/components/ui/badge';
|
|
import type { VulnerabilityCriteria } from '$lib/server/db';
|
|
import {
|
|
vulnerabilityCriteriaLabels,
|
|
vulnerabilityCriteriaIcons,
|
|
getCriteriaBadgeClass
|
|
} from '$lib/utils/update-steps';
|
|
|
|
interface Props {
|
|
criteria: VulnerabilityCriteria;
|
|
showLabel?: boolean;
|
|
}
|
|
|
|
let { criteria, showLabel = true }: Props = $props();
|
|
|
|
const iconConfig = $derived(vulnerabilityCriteriaIcons[criteria] || vulnerabilityCriteriaIcons.never);
|
|
const label = $derived(vulnerabilityCriteriaLabels[criteria] || criteria);
|
|
const badgeClass = $derived(getCriteriaBadgeClass(criteria));
|
|
</script>
|
|
|
|
<Badge variant="outline" class="text-xs {badgeClass}">
|
|
<svelte:component this={iconConfig.component} class={iconConfig.class} />
|
|
{#if showLabel}
|
|
<span class="ml-1">{label}</span>
|
|
{/if}
|
|
</Badge>
|