Skip to content

Commit

Permalink
Cleanup + requested changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
natalyjazzviolin committed Feb 7, 2025
1 parent ee47873 commit 7b43a98
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions src/components/Grid/Cell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,14 @@ export const Cell = memo(
}
});

console.log("Row height is: ", rowHeight);
const styleWithHeight = {
...style,
height: "auto"
}

return (
<div
style={{
...style,
height: "auto",
}}
style={styleWithHeight}
data-row={currentRowIndex}
data-column={columnIndex}
ref={cellRef}
Expand Down
4 changes: 2 additions & 2 deletions src/components/Grid/Grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,15 +218,15 @@ export const Grid = forwardRef<HTMLDivElement, GridProps>(
const getRowHeight = useCallback(
(index: number) => {
if (rowAutoHeight && rowHeightsRef.current.get(index)) {
return rowHeightsRef.current.get(index) + 33;
return rowHeightsRef.current.get(index) + rowHeight;
}
return rowHeight;
},
[rowHeight, rowAutoHeight]
);

const updateRowHeight = useCallback((rowIndex: number, height: number) => {
const prevHeight = rowHeightsRef.current.get(rowIndex) || 0;
const prevHeight = rowHeightsRef.current.get(rowIndex) ?? 0;
if (height > prevHeight) {
rowHeightsRef.current.set(rowIndex, height);
if (gridRef.current) {
Expand Down

0 comments on commit 7b43a98

Please sign in to comment.