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:
parent
eefb4c4287
commit
8b11e1678e
8 changed files with 230 additions and 139 deletions
|
@ -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>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue