Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fleet UI: Update Dropdown to use react-select 5.4 and other cleanup #24164

Merged
merged 7 commits into from
Dec 3, 2024

Conversation

RachelElysia
Copy link
Member

@RachelElysia RachelElysia commented Nov 26, 2024

Issue

Pre-quel to #22789

Description

  • Create DropdownWrapper which uses react-select 5.4, type script, and functional component (vs. Dropdown which uses react-select 1.3, javascript, and class component)
  • Dropdown wrapper tested for everything that is shown in storybook
  • Created DropdownWrapper in storybook
  • Prototype of DropdownWrapper used in the UI only in dropdowns in creating/editing user modal

Screenshots of dropdown

Displays options that are disabled, option that have help text, option that have tooltip

Screenshot 2024-11-26 at 10 35 39 AM

Displays disabled state, error state, dropdown help text

Screenshot 2024-11-26 at 10 35 05 AM

Updated dropdowns in UI

Screenshot 2024-11-26 at 10 59 25 AM Screenshot 2024-11-26 at 10 59 05 AM

Checklist for submitter

If some of the following don't apply, delete the relevant line.

  • Manual QA for all new/changed functionality

@RachelElysia RachelElysia marked this pull request as ready for review November 26, 2024 15:51
@RachelElysia RachelElysia requested a review from a team as a code owner November 26, 2024 15:51
Copy link

codecov bot commented Nov 26, 2024

Codecov Report

Attention: Patch coverage is 76.92308% with 18 lines in your changes missing coverage. Please review.

Project coverage is 54.11%. Comparing base (2f0af27) to head (afdff18).
Report is 63 commits behind head on main.

Files with missing lines Patch % Lines
...tPage/components/SelectRoleForm/SelectRoleForm.tsx 0.00% 9 Missing ⚠️
...s/forms/fields/DropdownWrapper/DropdownWrapper.tsx 89.23% 4 Missing and 3 partials ⚠️
...components/SelectedTeamsForm/SelectedTeamsForm.tsx 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #24164      +/-   ##
==========================================
+ Coverage   54.10%   54.11%   +0.01%     
==========================================
  Files        1580     1581       +1     
  Lines      150207   150274      +67     
  Branches     3818     3800      -18     
==========================================
+ Hits        81267    81325      +58     
- Misses      62220    62227       +7     
- Partials     6720     6722       +2     
Flag Coverage Δ
frontend 52.75% <76.92%> (+0.19%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jacobshandling
Copy link
Contributor

👀

value={getCurrentValue()}
onChange={handleChange}
isDisabled={isDisabled}
menuPortalTarget={document.body}
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to let this to be defined by the caller?

Copy link
Contributor

Choose a reason for hiding this comment

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

Could be an optional prop? menuPortalTarget || document.body as a default?

Copy link
Contributor

Choose a reason for hiding this comment

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

💯

Copy link
Contributor

Choose a reason for hiding this comment

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

Out of curiosity, the type signature in the library is menuPortalTarget?: HTMLElement | null; ref

And it looks like when you pass null it just appends it to the menu wrapper https://github.com/JedWatson/react-select/blob/master/packages/react-select/src/components/Menu.tsx#L701-L703

I guess not to break this functionality probably want something to the likes of

menuPortalTarget === undefined ? document.body : menuPortalTarget

@jacobshandling
Copy link
Contributor

This is awesome, thank you @RachelElysia

@RachelElysia RachelElysia merged commit f6425e6 into main Dec 3, 2024
14 checks passed
@RachelElysia RachelElysia deleted the fe-updated-dropdown-component branch December 3, 2024 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants