Skip to content

Commit eff3554

Browse files
committed
Update IndexesTable
1 parent d4c1de6 commit eff3554

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

packages/compass-indexes/src/components/indexes-table/indexes-table.tsx

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,11 @@ export function IndexesTable<T>({
9999
`${id}-sorting-state`,
100100
[]
101101
);
102-
const tableContainerRef = React.useRef<HTMLDivElement>(null);
103102
const table = useLeafyGreenTable<T>({
104-
containerRef: tableContainerRef,
105103
data,
106104
columns,
107-
enableExpanding: true,
108105
enableSortingRemoval: false,
106+
withPagination: false,
109107
state: { sorting },
110108
onSortingChange: setSorting,
111109
});
@@ -120,7 +118,6 @@ export function IndexesTable<T>({
120118
className={tableStyles}
121119
data-testid={`${dataTestId}-list`}
122120
table={table}
123-
ref={tableContainerRef}
124121
>
125122
<TableHead
126123
isSticky
@@ -147,26 +144,30 @@ export function IndexesTable<T>({
147144
))}
148145
</TableHead>
149146
<TableBody>
150-
{rows.map((row: LeafyGreenTableRow<T>) => {
151-
return (
147+
{rows.map((row: LeafyGreenTableRow<T>) =>
148+
row.isExpandedContent ? (
149+
<ExpandedContent key={row.id} row={row} />
150+
) : (
152151
<Row
153-
className={rowStyles}
154152
key={row.id}
155153
row={row}
154+
className={rowStyles}
156155
data-testid={`${dataTestId}-row-${
157156
(row.original as { name?: string }).name ?? row.id
158157
}`}
159158
>
160159
{row.getVisibleCells().map((cell: LeafyGreenTableCell<T>) => {
161160
return (
162161
<Cell
162+
key={cell.id}
163+
id={cell.id}
164+
cell={cell}
163165
className={cx(
164166
cell.column.id === 'actions' && indexActionsCellStyles,
165167
cell.column.id === 'actions' &&
166168
indexActionsCellClassName
167169
)}
168170
data-testid={`${dataTestId}-${cell.column.id}-field`}
169-
key={cell.id}
170171
>
171172
{flexRender(
172173
cell.column.columnDef.cell,
@@ -175,13 +176,9 @@ export function IndexesTable<T>({
175176
</Cell>
176177
);
177178
})}
178-
179-
{row.original.renderExpandedContent && (
180-
<ExpandedContent row={row} />
181-
)}
182179
</Row>
183-
);
184-
})}
180+
)
181+
)}
185182
</TableBody>
186183
</Table>
187184
</div>

0 commit comments

Comments
 (0)