Skip to content

Commit

Permalink
refactor: do not set width to cell
Browse files Browse the repository at this point in the history
  • Loading branch information
ogonkov committed Jul 19, 2023
1 parent 286b687 commit c01ad33
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/components/Table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ export class Table<I extends TableDataItem = Record<string, string>> extends Rea
<th
key={id}
ref={this.state.columnHeaderRefs[index]}
style={columnsStyles[index]}
style={this.getCellStyles(columnsStyles[index])}
className={b(
'cell',
{
Expand Down Expand Up @@ -439,7 +439,7 @@ export class Table<I extends TableDataItem = Record<string, string>> extends Rea
return (
<td
key={id}
style={columnsStyles[colIndex]}
style={this.getCellStyles(columnsStyles[colIndex])}
className={b(
'cell',
{
Expand Down Expand Up @@ -528,6 +528,13 @@ export class Table<I extends TableDataItem = Record<string, string>> extends Rea
return style;
}

private getCellStyles({
width: _width,
...styles
}: React.CSSProperties): React.CSSProperties | undefined {
return Object.keys(styles).length ? styles : undefined;
}

private handleScrollContainerMouseenter = () => {
this.setState({activeScrollElement: 'scrollContainer'});
};
Expand Down

0 comments on commit c01ad33

Please sign in to comment.