Skip to content

Commit

Permalink
IBX-7252: Add react dropdown disabled state (#1018)
Browse files Browse the repository at this point in the history
  • Loading branch information
tischsoic authored Dec 1, 2023
1 parent f0e826f commit 8ed6698
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/bundle/ui-dev/src/modules/common/dropdown/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const Dropdown = ({
onChange,
small,
single,
disabled,
placeholder,
extraClasses,
renderSelectedItem,
Expand All @@ -39,12 +40,13 @@ const Dropdown = ({
'ibexa-dropdown--single': single,
'ibexa-dropdown--multi': !single,
'ibexa-dropdown--small': small,
'ibexa-dropdown--disabled': disabled,
'ibexa-dropdown--expanded': isExpanded,
[extraClasses]: true,
});
const toggleExpanded = () => {
calculateAndSetItemsListStyles();
setIsExpanded((prevState) => !prevState);
setIsExpanded((prevState) => !prevState && !disabled);
};
const updateFilterValue = (event) => setFilterText(event.target.value);
const resetInputValue = () => setFilterText('');
Expand Down Expand Up @@ -264,6 +266,7 @@ Dropdown.propTypes = {
onChange: PropTypes.func.isRequired,
small: PropTypes.bool,
single: PropTypes.bool,
disabled: PropTypes.bool,
placeholder: PropTypes.string,
extraClasses: PropTypes.string,
renderSelectedItem: PropTypes.func,
Expand All @@ -273,6 +276,7 @@ Dropdown.propTypes = {
Dropdown.defaultProps = {
small: false,
single: false,
disabled: false,
placeholder: null,
extraClasses: '',
renderSelectedItem: (item) => item?.label,
Expand Down

0 comments on commit 8ed6698

Please sign in to comment.