-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Expand file tree
/
Copy pathindex.tsx
More file actions
34 lines (28 loc) · 868 Bytes
/
index.tsx
File metadata and controls
34 lines (28 loc) · 868 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import type { BadgeKind } from '@node-core/ui-components/Common/Badge';
import Badge from '@node-core/ui-components/Common/Badge';
import { useTranslations } from 'next-intl';
import type { FC } from 'react';
import { SEVERITY_KIND_MAP } from '#site/next.constants.mjs';
import type { Severity } from '#site/types';
import styles from './index.module.css';
type VulnerabilityChipProps = {
severity: Severity;
count?: number;
};
const VulnerabilityChip: FC<VulnerabilityChipProps> = ({
severity,
count = 0,
}) => {
const t = useTranslations();
return (
<Badge
size="small"
kind={SEVERITY_KIND_MAP[severity] as BadgeKind}
className="mr-1"
>
{count > 0 ? <span className={styles.chipCount}>{count}</span> : null}
{t(`components.eolChip.severity.${severity}`)}
</Badge>
);
};
export default VulnerabilityChip;