-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathTableWithControlsLayout.tsx
41 lines (33 loc) · 1.07 KB
/
TableWithControlsLayout.tsx
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 {cn} from '../../utils/cn';
import {TableSkeleton} from '../TableSkeleton/TableSkeleton';
import './TableWithControlsLayout.scss';
const b = cn('ydb-table-with-controls-layout');
interface TableWithControlsLayoutItemProps {
children: React.ReactNode;
className?: string;
}
interface TableProps extends TableWithControlsLayoutItemProps {
loading?: boolean;
}
export const TableWithControlsLayout = ({
children,
className,
}: TableWithControlsLayoutItemProps) => {
return <div className={b(null, className)}>{children}</div>;
};
TableWithControlsLayout.Controls = function TableControls({
children,
className,
}: TableWithControlsLayoutItemProps) {
return (
<div className={b('controls-wrapper')}>
<div className={b('controls', className)}>{children}</div>
</div>
);
};
TableWithControlsLayout.Table = function Table({children, loading, className}: TableProps) {
if (loading) {
return <TableSkeleton className={b('loader')} />;
}
return <div className={b('table', className)}>{children}</div>;
};