Add rowHeight prop to Datagrid component (#3888)

* Add rowHeight prop to Datagrid component

* Add changeset
This commit is contained in:
Carlos Ramírez 2023-07-10 00:48:19 -07:00 committed by GitHub
parent 6d6d1588b3
commit 093388c46f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
"saleor-dashboard": minor
---
Add rowHeight prop to Datagrid component

View file

@ -105,6 +105,7 @@ export interface DatagridProps {
columnSelect?: DataEditorProps["columnSelect"]; columnSelect?: DataEditorProps["columnSelect"];
showEmptyDatagrid?: boolean; showEmptyDatagrid?: boolean;
rowAnchor?: (item: Item) => string; rowAnchor?: (item: Item) => string;
rowHeight?: number | ((index: number) => number);
actionButtonPosition?: "left" | "right"; actionButtonPosition?: "left" | "right";
recentlyAddedColumn?: string; // Enables scroll to recently added column recentlyAddedColumn?: string; // Enables scroll to recently added column
} }
@ -139,6 +140,7 @@ export const Datagrid: React.FC<DatagridProps> = ({
onRowSelectionChange, onRowSelectionChange,
actionButtonPosition = "left", actionButtonPosition = "left",
recentlyAddedColumn, recentlyAddedColumn,
rowHeight = cellHeight,
...datagridProps ...datagridProps
}): ReactElement => { }): ReactElement => {
const classes = useStyles({ actionButtonPosition }); const classes = useStyles({ actionButtonPosition });
@ -523,7 +525,7 @@ export const Datagrid: React.FC<DatagridProps> = ({
onItemHovered={handleRowHover} onItemHovered={handleRowHover}
getRowThemeOverride={handleGetThemeOverride} getRowThemeOverride={handleGetThemeOverride}
gridSelection={selection} gridSelection={selection}
rowHeight={cellHeight} rowHeight={rowHeight}
headerHeight={cellHeight} headerHeight={cellHeight}
ref={editor} ref={editor}
onPaste onPaste