forked from nodejs/nodejs.org
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.tsx
More file actions
27 lines (22 loc) · 698 Bytes
/
index.tsx
File metadata and controls
27 lines (22 loc) · 698 Bytes
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
import type { TableColumn, TableData } from '#ui/types';
import DesktopTable from './DesktopTable';
import MobileTable from './MobileTable';
export interface ResponsiveTableProps<T extends TableData> {
data: Array<T>;
columns: Array<TableColumn>;
getRowId: (row: T, index: number) => string;
getRowLabel?: (row: T) => string;
}
function ResponsiveTable<T extends TableData>(props: ResponsiveTableProps<T>) {
return (
<div className="w-full">
<div className="hidden overflow-x-auto lg:block">
<DesktopTable {...props} />
</div>
<div className="lg:hidden">
<MobileTable {...props} />
</div>
</div>
);
}
export default ResponsiveTable;