-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Expand file tree
/
Copy pathVulnerabilitiesTable.tsx
More file actions
76 lines (68 loc) · 2.39 KB
/
VulnerabilitiesTable.tsx
File metadata and controls
76 lines (68 loc) · 2.39 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import { useTranslations } from 'next-intl';
import LinkWithArrow from '#site/components/Common/LinkWithArrow';
import VulnerabilityChip from '#site/components/EOL/VulnerabilityChips/VulnerabilityChip';
import type { Vulnerability } from '#site/types/vulnerabilities';
import type { FC } from 'react';
const VulnerabilitiesTable: FC<{
vulnerabilities: Array<Vulnerability>;
maxWidth?: string;
}> = ({ vulnerabilities, maxWidth = 'md:max-w-2xs' }) => {
const t = useTranslations();
if (!vulnerabilities.length) {
return null;
}
return (
<table className="w-full">
<thead>
<tr>
<th>{t('components.eolModal.table.cves')}</th>
<th>{t('components.eolModal.table.severity')}</th>
<th>{t('components.eolModal.table.overview')}</th>
<th>{t('components.eolModal.table.details')}</th>
</tr>
</thead>
<tbody>
{vulnerabilities.map(vulnerability => (
<tr key={vulnerability.url}>
<td data-label={t('components.eolModal.table.cves')}>
{vulnerability.cve.map(cveId => (
<div key={cveId}>
<LinkWithArrow
href={`https://www.cve.org/CVERecord?id=${cveId}`}
target="_blank"
rel="noopener noreferrer"
>
{cveId}
</LinkWithArrow>
</div>
))}
{vulnerability.cve.length > 0 || '-'}
</td>
<td data-label={t('components.eolModal.table.severity')}>
<VulnerabilityChip severity={vulnerability.severity} />
</td>
<td
data-label={t('components.eolModal.table.overview')}
className={maxWidth}
>
{vulnerability.description || vulnerability.overview || '-'}
</td>
<td data-label={t('components.eolModal.table.details')}>
{vulnerability.url && (
<LinkWithArrow
href={vulnerability.url}
target="_blank"
rel="noopener noreferrer"
>
{t('components.eolModal.blogLinkText')}
</LinkWithArrow>
)}
{!!vulnerability.url || '-'}
</td>
</tr>
))}
</tbody>
</table>
);
};
export default VulnerabilitiesTable;