Skip to content

Commit

Permalink
fix: select: fixes pills layout and removes redundant options change
Browse files Browse the repository at this point in the history
The redundant options change was triggering a second onClick event with no value
  • Loading branch information
dkilgore-eightfold committed Aug 23, 2022
1 parent bf44706 commit 1623136
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
12 changes: 2 additions & 10 deletions src/components/Select/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export const Select: FC<SelectProps> = React.forwardRef(
size === SelectSize.Flex && smallScreenActive,
},
{
[styles.selectSmall]:
[styles.selectLarge]:
size === SelectSize.Flex && xSmallScreenActive,
},
{ [styles.selectLarge]: size === SelectSize.Large },
Expand Down Expand Up @@ -279,14 +279,6 @@ export const Select: FC<SelectProps> = React.forwardRef(
);
};

const onDropdownVisibilityChange = (isVisible: boolean) => {
setDropdownVisibility(isVisible);
setSearchQuery('');
setOptions(
options.map((option) => ({ ...option, hideOption: false }))
);
};

const OptionMenu = ({ options }: { options: SelectOption[] }) => {
const filteredOptions = options.filter(
(option) => !option.hideOption
Expand Down Expand Up @@ -373,7 +365,7 @@ export const Select: FC<SelectProps> = React.forwardRef(
<Dropdown
{...dropdownProps}
onVisibleChange={(isVisible) =>
onDropdownVisibilityChange(isVisible)
setDropdownVisibility(isVisible)
}
showDropdown={showDropdown}
overlay={
Expand Down
4 changes: 2 additions & 2 deletions src/components/Select/select.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
padding: 0;

.select-spinner {
margin: 4px auto;
margin: 10px auto;
position: relative;
}
}
Expand Down Expand Up @@ -81,7 +81,7 @@

.select-menu-empty {
color: var(--grey-color-60);
margin: 10px auto;
margin: $space-m;
position: relative;
}

Expand Down

0 comments on commit 1623136

Please sign in to comment.