Skip to content

Commit

Permalink
[feat] add prop to allow turning off custom webkit scrollbar CSS (#2316)
Browse files Browse the repository at this point in the history
Signed-off-by: Ihor Dykhta <[email protected]>
Co-authored-by: Jacob Wasilkowski <[email protected]>
  • Loading branch information
igorDykhta and jwasilgeo authored Sep 18, 2023
1 parent 69ce4d0 commit 66a6364
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/components/src/common/data-table/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ const unpinnedClassList = {
rows: 'unpinned-columns--rows unpinned-grid-container'
};

export const Container = styled.div`
type ContainerProps = {
hasCustomScrollBarStyle?: boolean;
};

export const Container = styled.div<ContainerProps>`
display: flex;
font-size: 11px;
flex-grow: 1;
Expand All @@ -72,7 +76,7 @@ export const Container = styled.div`
outline: 0;
}
.body-grid {
${props => props.theme.modalScrollBar}
${props => props.hasCustomScrollBarStyle && props.theme.modalScrollBar}
}
.cell {
Expand Down Expand Up @@ -401,6 +405,7 @@ export interface DataTableProps {
copyTableColumn: (column: string) => void;
sortOrder?: number[] | null;
showStats?: boolean;
hasCustomScrollBarStyle?: boolean;
}

interface DataTableState {
Expand All @@ -422,7 +427,8 @@ function DataTableFactory(HeaderCell: ReturnType<typeof HeaderCellFactory>) {
fixedWidth: null,
fixedHeight: null,
theme: {},
hasStats: false
hasStats: false,
hasCustomScrollBarStyle: true
};

pinnedGrid = false;
Expand Down Expand Up @@ -558,7 +564,8 @@ function DataTableFactory(HeaderCell: ReturnType<typeof HeaderCellFactory>) {
theme = {},
fixedWidth,
fixedHeight = 0,
hasStats
hasStats,
hasCustomScrollBarStyle
} = this.props;
const unpinnedColumns = this.unpinnedColumns(this.props);

Expand Down Expand Up @@ -604,7 +611,11 @@ function DataTableFactory(HeaderCell: ReturnType<typeof HeaderCellFactory>) {
};

return (
<Container className="data-table-container" ref={this.root}>
<Container
className="data-table-container"
ref={this.root}
hasCustomScrollBarStyle={hasCustomScrollBarStyle}
>
{Object.keys(cellSizeCache).length ? (
<>
<ScrollSync>
Expand Down

0 comments on commit 66a6364

Please sign in to comment.