2022-09-02 18:30:34 +03:00
|
|
|
import { PropsWithChildren } from 'react';
|
2022-01-04 14:16:09 +02:00
|
|
|
|
2022-06-17 19:18:42 +03:00
|
|
|
import { Widget, WidgetBody } from '@@/Widget';
|
2022-01-04 14:16:09 +02:00
|
|
|
|
2022-11-22 14:16:34 +02:00
|
|
|
interface Props {
|
|
|
|
// workaround to remove the widget, ideally we should have a different component to wrap the table with a widget
|
|
|
|
noWidget?: boolean;
|
2024-02-29 09:26:13 +02:00
|
|
|
'aria-label'?: string;
|
2025-05-13 22:15:04 +12:00
|
|
|
id?: string;
|
2022-11-22 14:16:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export function TableContainer({
|
|
|
|
children,
|
|
|
|
noWidget = false,
|
2024-02-29 09:26:13 +02:00
|
|
|
'aria-label': ariaLabel,
|
2025-05-13 22:15:04 +12:00
|
|
|
id,
|
2022-11-22 14:16:34 +02:00
|
|
|
}: PropsWithChildren<Props>) {
|
|
|
|
if (noWidget) {
|
2024-02-29 09:26:13 +02:00
|
|
|
return (
|
|
|
|
<section className="datatable" aria-label={ariaLabel}>
|
|
|
|
{children}
|
|
|
|
</section>
|
|
|
|
);
|
2022-11-22 14:16:34 +02:00
|
|
|
}
|
|
|
|
|
2022-01-04 14:16:09 +02:00
|
|
|
return (
|
2022-11-22 14:16:34 +02:00
|
|
|
<div className="row">
|
|
|
|
<div className="col-sm-12">
|
2024-03-27 09:56:00 +02:00
|
|
|
<div className="datatable">
|
2025-05-13 22:15:04 +12:00
|
|
|
<Widget aria-label={ariaLabel} id={id}>
|
2022-11-22 14:16:34 +02:00
|
|
|
<WidgetBody className="no-padding">{children}</WidgetBody>
|
|
|
|
</Widget>
|
2024-03-27 09:56:00 +02:00
|
|
|
</div>
|
2022-11-22 14:16:34 +02:00
|
|
|
</div>
|
2022-09-02 18:30:34 +03:00
|
|
|
</div>
|
2022-01-04 14:16:09 +02:00
|
|
|
);
|
|
|
|
}
|