Skip to content

OBPIH-6014 Fix async select dropdown to be wider for longer labels#4482

Merged
awalkowiak merged 3 commits intofeature/product-supplier-list-redesignfrom
OBPIH-6014-design-fix
Jan 31, 2024
Merged

OBPIH-6014 Fix async select dropdown to be wider for longer labels#4482
awalkowiak merged 3 commits intofeature/product-supplier-list-redesignfrom
OBPIH-6014-design-fix

Conversation

@kchelstowski
Copy link
Collaborator

The point was to re-create the dropdown and its width when the options change, because before for the async select, the width has never dynamically changed regarding the options that were loaded.
Thanks for pair programing @drodzewicz @alannadolny

Copy link
Collaborator

@drodzewicz drodzewicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good but fix the hook state name

const dropdownWidth = inputContainerWidth > currentDropdownWidth
? inputContainerWidth
: currentDropdownWidth;
const [drpWidth, setDtrWidth] = useState(undefined);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const [drpWidth, setDtrWidth] = useState(undefined);
const [dropdownWidth, setDropdownWidth] = useState(undefined);

style={{
...style,
width: dropdownWidth,
width: drpWidth,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
width: drpWidth,
width: dropdownWidth,

<Dropdown inputContainerRec={inputContainer.getBoundingClientRect()} >
<Dropdown
inputContainerRec={inputContainer.getBoundingClientRect()}
hasOptions={!!props.options.length}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are props.options required? Is it possible it will be null? Should it be a part of propTypes?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

options prop from the react-select is an empty array by default.

@awalkowiak awalkowiak merged commit 495ca4c into feature/product-supplier-list-redesign Jan 31, 2024
@awalkowiak awalkowiak deleted the OBPIH-6014-design-fix branch January 31, 2024 11:49
awalkowiak pushed a commit that referenced this pull request Mar 12, 2024
…4482)

* OBPIH-6014 Fix async select dropdown to be wider for longer labels

* OBPIH-6014 Change state name to dropdownWidth (fix after review)

* OBPIH-6014 Add prop type for the options
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants