Skip to content

Commit

Permalink
add prop to set a static column width of Grid View
Browse files Browse the repository at this point in the history
  • Loading branch information
paola-p committed Jan 8, 2024
1 parent a447378 commit d072a05
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const GRID_VIEW_PROP_TYPES = {
rows: PropTypes.array,
headerGroups: PropTypes.array,
prepareRow: PropTypes.func,
staticColumnWidth: PropTypes.bool,
};

const GridView = ({
Expand Down Expand Up @@ -64,6 +65,14 @@ const GridView = ({
rows.length < columns
? `minmax(${itemMinWidth}px, ${itemMinWidth}px)`
: `minmax(${itemMinWidth}px, 1fr)`;

if (props.staticColumnWidth)
return {
...style,
display: 'grid',
gridTemplateColumns: `repeat(auto-fit, ${itemMinWidth})`,
};

return {
...style,
display: 'grid',
Expand Down

0 comments on commit d072a05

Please sign in to comment.