Skip to content

Commit

Permalink
fix: histogram position in rtl mode
Browse files Browse the repository at this point in the history
  • Loading branch information
quanho committed Mar 24, 2023
1 parent 64a3b20 commit cd69749
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ function RowColumn({ index, rowIndex, columnIndex, style, data }) {
isGridMode={dataLayout === 'grid'}
dense={dense}
frequencyWidth={frequencyWidth}
direction={direction}
data-testid="listbox.item"
>
<ItemGrid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ import getItemSizes from '../../grid-list-components/item-sizes';
import classes from '../helpers/classes';

const ItemGrid = styled(Grid, {
shouldForwardProp: (prop) => !['dataLayout', 'layoutOrder', 'itemPadding', 'checkboxes'].includes(prop),
})(({ dataLayout, layoutOrder, itemPadding, cellPaddingRight }) => ({
[`&.${classes.fieldRoot}`]: {
...getItemSizes({ dataLayout, layoutOrder, itemPadding }),
paddingRight: cellPaddingRight ? '8px' : undefined,
},
}));
shouldForwardProp: (prop) =>
!['dataLayout', 'layoutOrder', 'itemPadding', 'cellPaddingRight', 'direction'].includes(prop),
})(({ dataLayout, layoutOrder, itemPadding, cellPaddingRight, direction }) => {
const att = `padding${direction === 'rtl' ? 'left' : 'right'}`;
return {
[`&.${classes.fieldRoot}`]: {
...getItemSizes({ dataLayout, layoutOrder, itemPadding }),
[att]: cellPaddingRight ? '8px' : undefined,
},
};
});

export default ItemGrid;
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ const ellipsis = {
const iconWidth = 24; // tick and lock icon width in px

const RowColRoot = styled('div', {
shouldForwardProp: (prop) => !['flexBasisProp', 'isGridMode', 'isGridCol', 'dense', 'frequencyWidth'].includes(prop),
})(({ theme, flexBasisProp, isGridMode, isGridCol, dense, frequencyWidth }) => ({
shouldForwardProp: (prop) =>
!['flexBasisProp', 'isGridMode', 'isGridCol', 'dense', 'frequencyWidth', 'direction'].includes(prop),
})(({ theme, flexBasisProp, isGridMode, isGridCol, dense, frequencyWidth, direction }) => ({
'&:focus': {
boxShadow: `inset 0 0 0 2px ${theme.palette.custom.focusBorder} !important`,
},
Expand Down Expand Up @@ -188,7 +189,7 @@ const RowColRoot = styled('div', {
},

[`& .${classes.barWithCheckbox}`]: {
left: barWithCheckboxLeftPadPx,
left: direction === 'rtl' ? barPadPx : barWithCheckboxLeftPadPx,
width: `calc(100% - ${barWithCheckboxLeftPadPx + barPadPx}px)`,
},

Expand Down

0 comments on commit cd69749

Please sign in to comment.