-
Notifications
You must be signed in to change notification settings - Fork 137
Expand file tree
/
Copy pathGrid.tsx
More file actions
33 lines (27 loc) · 1.02 KB
/
Grid.tsx
File metadata and controls
33 lines (27 loc) · 1.02 KB
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
import { useEffect } from 'react';
import { useDatabaseContext, useDatabaseViewId, useRowOrdersSelector } from '@/application/database-yjs';
import { useRenderFields } from '@/components/database/components/grid/grid-column';
import GridVirtualizer from '@/components/database/components/grid/grid-table/GridVirtualizer';
import { GridProvider } from '@/components/database/grid/GridProvider';
export function Grid() {
const { fields } = useRenderFields();
const viewId = useDatabaseViewId();
const rowOrders = useRowOrdersSelector();
const { onRendered } = useDatabaseContext();
useEffect(() => {
if (fields && rowOrders !== undefined) {
onRendered?.();
}
}, [fields, rowOrders, onRendered]);
return (
<GridProvider rowOrders={rowOrders}>
<div
data-testid='database-grid'
className={`database-grid relative grid-table-${viewId} flex w-full min-h-0 flex-1 flex-col`}
>
<GridVirtualizer columns={fields} />
</div>
</GridProvider>
);
}
export default Grid;