Skip to content

Commit

Permalink
fix: add icon width only when present (#1166)
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielS-Qlik committed Mar 21, 2023
1 parent d83e6e6 commit 2ad8fda
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions apis/nucleus/src/components/listbox/ListBoxInline.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ const classes = {
listboxWrapper: `${PREFIX}-listboxWrapper`,
};

const StyledGrid = styled(Grid, { shouldForwardProp: (p) => !['containerPadding'].includes(p) })(
({ theme, containerPadding }) => ({
const StyledGrid = styled(Grid, { shouldForwardProp: (p) => !['containerPadding', 'hasIcon'].includes(p) })(
({ theme, containerPadding, hasIcon }) => ({
backgroundColor: theme.listBox?.backgroundColor ?? theme.palette.background.default,
[`& .${classes.listBoxHeader}`]: {
alignSelf: 'center',
display: 'flex',
width: `calc(100% - ${BUTTON_ICON_WIDTH}px)`,
width: `calc(100% - ${hasIcon ? BUTTON_ICON_WIDTH : 0}px)`,
},
[`& .${classes.screenReaderOnly}`]: {
position: 'absolute',
Expand Down Expand Up @@ -260,6 +260,7 @@ function ListBoxInline({ options, layout }) {
onMouseEnter={handleOnMouseEnter}
onMouseLeave={handleOnMouseLeave}
ref={containerRef}
hasIcon={showIcons}
>
{toolbar && (
<Grid
Expand Down

0 comments on commit 2ad8fda

Please sign in to comment.