1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-24 15:59:41 +02:00

refactor(settings): migrate hidden containers panel to react [EE-5507] (#9119)

This commit is contained in:
Chaim Lev-Ari 2023-07-10 03:39:11 +07:00 committed by GitHub
parent eefb4c4287
commit 8b11e1678e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 230 additions and 139 deletions

View file

@ -1,17 +1,22 @@
import { PropsWithChildren } from 'react';
import clsx from 'clsx';
import { Children, PropsWithChildren } from 'react';
type Props = {
headers?: string[];
dataCy?: string;
className?: string;
emptyMessage?: string;
};
export function DetailsTable({
headers = [],
dataCy,
className,
emptyMessage,
children,
}: PropsWithChildren<Props>) {
return (
<table className="table" data-cy={dataCy}>
<table className={clsx('table', className)} data-cy={dataCy}>
{headers.length > 0 && (
<thead>
<tr>
@ -21,7 +26,17 @@ export function DetailsTable({
</tr>
</thead>
)}
{children && <tbody>{children}</tbody>}
<tbody>
{Children.count(children) > 0 ? (
children
) : (
<tr>
<td colSpan={headers.length} className="text-muted text-center">
{emptyMessage}
</td>
</tr>
)}
</tbody>
</table>
);
}