2022-05-09 21:01:15 +00:00
|
|
|
import { PropsWithChildren } from 'react';
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
headers?: string[];
|
|
|
|
dataCy?: string;
|
|
|
|
};
|
|
|
|
|
|
|
|
export function DetailsTable({
|
|
|
|
headers = [],
|
|
|
|
dataCy,
|
|
|
|
children,
|
|
|
|
}: PropsWithChildren<Props>) {
|
|
|
|
return (
|
|
|
|
<table className="table" data-cy={dataCy}>
|
|
|
|
{headers.length > 0 && (
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
{headers.map((header) => (
|
|
|
|
<th key={header}>{header}</th>
|
|
|
|
))}
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
)}
|
2023-05-02 06:42:16 +00:00
|
|
|
{children && <tbody>{children}</tbody>}
|
2022-05-09 21:01:15 +00:00
|
|
|
</table>
|
|
|
|
);
|
|
|
|
}
|