-
Notifications
You must be signed in to change notification settings - Fork 66.9k
Expand file tree
/
Copy pathRestStatusCodes.tsx
More file actions
41 lines (37 loc) · 1.06 KB
/
RestStatusCodes.tsx
File metadata and controls
41 lines (37 loc) · 1.06 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
import { useTranslation } from '@/languages/components/useTranslation'
import { StatusCode } from './types'
type Props = {
statusCodes: Array<StatusCode>
slug: string
heading: string
}
export function RestStatusCodes({ statusCodes, slug, heading }: Props) {
const { t } = useTranslation('rest_reference')
return (
<>
<h3 className="mt-4 mb-3 pt-3 h4" id={`${slug}--status-codes`}>
<a href={`#${slug}--status-codes`}>{heading}</a>
</h3>
<table>
<thead>
<tr className="text-left">
<th>{t('status_code')}</th>
<th>{t('description')}</th>
</tr>
</thead>
<tbody>
{statusCodes.map((statusCode, index) => (
<tr key={`${statusCode.description}-${index}}`}>
<td>
<code>{statusCode.httpStatusCode}</code>
</td>
<td>
<div dangerouslySetInnerHTML={{ __html: statusCode.description }} />
</td>
</tr>
))}
</tbody>
</table>
</>
)
}