Skip to content

Commit

Permalink
Hide separators and show on columnHeaders' hover
Browse files Browse the repository at this point in the history
  • Loading branch information
MBilalShafi committed Dec 19, 2022
1 parent 3f247e5 commit ea20b88
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ function GridColumnGroupHeader(props: GridColumnGroupHeaderProps) {
aria-colspan={fields.length}
// The fields are wrapped between |-...-| to avoid confusion between fields "id" and "id2" when using selector data-fields~=
data-fields={`|-${fields.join('-|-')}-|`}
disableHeaderSeparator
{...mouseEventsHandlers}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ interface GridGenericColumnHeaderItemProps
label: string;
draggableContainerProps?: Partial<React.HTMLProps<HTMLDivElement>>;
columnHeaderSeparatorProps?: Partial<GridColumnHeaderSeparatorProps>;
disableHeaderSeparator?: boolean;
}

const GridGenericColumnHeaderItem = React.forwardRef(function GridGenericColumnHeaderItem(
Expand Down Expand Up @@ -69,7 +68,6 @@ const GridGenericColumnHeaderItem = React.forwardRef(function GridGenericColumnH
resizable,
draggableContainerProps,
columnHeaderSeparatorProps,
disableHeaderSeparator,
...other
} = props;

Expand Down Expand Up @@ -135,15 +133,13 @@ const GridGenericColumnHeaderItem = React.forwardRef(function GridGenericColumnH
</div>
{columnMenuIconButton}
</div>
{!disableHeaderSeparator && (
<GridColumnHeaderSeparator
resizable={!rootProps.disableColumnResize && !!resizable}
resizing={isResizing}
height={height}
side={separatorSide}
{...columnHeaderSeparatorProps}
/>
)}
<GridColumnHeaderSeparator
resizable={!rootProps.disableColumnResize && !!resizable}
resizing={isResizing}
height={height}
side={separatorSide}
{...columnHeaderSeparatorProps}
/>
{columnMenu}
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,19 @@ export const GridRootStyles = styled('div', {
backgroundColor: (theme.vars || theme).palette.action.hover,
},
[`& .${gridClasses.columnSeparator}`]: {
visibility: 'hidden',
position: 'absolute',
zIndex: 100,
display: 'flex',
flexDirection: 'column',
justifyContent: 'center',
color: borderColor,
},
[`& .${gridClasses.columnHeaders}:hover .${gridClasses.columnSeparator}, .${gridClasses['columnSeparator--resizing']}`]:
{
visibility: 'visible',
width: 'auto',
},
[`& .${gridClasses['columnSeparator--sideLeft']}`]: {
left: -12,
},
Expand Down

0 comments on commit ea20b88

Please sign in to comment.