-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathindex.jsx
More file actions
56 lines (50 loc) · 1.62 KB
/
index.jsx
File metadata and controls
56 lines (50 loc) · 1.62 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
import Badge from '@node-core/ui-components/Common/Badge';
import styles from './index.module.css';
const STABILITY_KINDS = ['error', 'warning', 'success', 'info'];
const STABILITY_TOOLTIPS = ['Deprecated', 'Experimental', 'Stable', 'Legacy'];
/**
* @typedef StabilityOverviewEntry
* @property {string} api - The API identifier (basename, e.g. "fs")
* @property {string} name - The human-readable display name of the API module
* @property {number} stabilityIndex - The stability level index (0–3)
* @property {string} stabilityDescription - First sentence of the stability description
*/
/**
* Renders a table summarising the stability level of each API module.
*
* @param {{ entries: Array<StabilityOverviewEntry> }} props
*/
export default ({ entries = [] }) => {
if (!entries.length) {
return null;
}
return (
<table className={styles.table}>
<thead>
<tr>
<th>API</th>
<th>Stability</th>
</tr>
</thead>
<tbody>
{entries.map(({ api, name, stabilityIndex, stabilityDescription }) => (
<tr key={api}>
<td>
<a href={`${api}.html`}>{name}</a>
</td>
<td className={styles.stabilityCell}>
<Badge
kind={STABILITY_KINDS[stabilityIndex]}
data-tooltip={STABILITY_TOOLTIPS[stabilityIndex]}
aria-label={`Stability: ${STABILITY_TOOLTIPS[stabilityIndex]}`}
>
{stabilityIndex}
</Badge>
{` ${stabilityDescription}`}
</td>
</tr>
))}
</tbody>
</table>
);
};