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

Adjust Select selected options UI #1659

Merged
merged 2 commits into from
Aug 19, 2024
Merged

Adjust Select selected options UI #1659

merged 2 commits into from
Aug 19, 2024

Conversation

acelaya
Copy link
Contributor

@acelaya acelaya commented Aug 19, 2024

This PR is the first one for #1658

This PR only changes how selected options look like in both Select and MultiSelect, to look like in the new UI designs:

image

Everything related with MultiSelect checkboxes will come after.

Changes

Before:

Grabacion.de.pantalla.desde.2024-08-19.11-56-42.webm

After:

Grabacion.de.pantalla.desde.2024-08-19.11-55-39.webm

Considerations

With these changes, selected options have a tick on the right side. This looks slightly awkward with some of the examples in the pattern library, specifically the ones with custom options.

Grabacion.de.pantalla.desde.2024-08-19.11-33-52.webm

However, customizing options is just a capability provided by the component, and not its own responsibility to ensure it looks good. Many other things could look awkward even with previous design, so I think this should be considered the consumer's responsibility.

This PR adds a second commit which adjusts those examples to look better.

Grabacion.de.pantalla.desde.2024-08-19.12-35-24.webm

Todo

  • Adjust keyboard navigation/focus ring UI
  • Update existing examples which don't look great with the new UI

@acelaya acelaya force-pushed the select-new-design branch from 2295acc to 2f21ab2 Compare August 19, 2024 09:58
@@ -99,11 +99,10 @@ function SelectOption<T>({
<li
className={classnames(
'w-full ring-inset outline-none rounded-none select-none',
'border-t first:border-t-0 whitespace-nowrap',
'px-1 mb-1 first:mt-1 whitespace-nowrap group',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have decided to implement spacing using margins and padding on the options, so that it's easier to eventually include the search boxes.

Copy link
Member

Choose a reason for hiding this comment

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

This is fine, but can you clarify how this makes adding the search boxes easier?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes.

I initially considered adding a small padding to the surrounding listbox, but according to the designs, the search box container should span to the very sides of said listbox.

image

Adding the padding to every individual option instead, ensures that will be eventually possible.

Copy link

codecov bot commented Aug 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (dc0033d) to head (a02ae4e).
Report is 2 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##           main     #1659        +/-   ##
===========================================
+ Coverage      0   100.00%   +100.00%     
===========================================
  Files         0        61        +61     
  Lines         0      1040      +1040     
  Branches      0       402       +402     
===========================================
+ Hits          0      1040      +1040     

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

@robertknight
Copy link
Member

If anything, we could update those examples, so that the ones in the pattern library look good, at least.

Yes. Some small tweaks to the item layout in that example would solve the problem.

@acelaya acelaya marked this pull request as ready for review August 19, 2024 10:02
@acelaya acelaya force-pushed the select-new-design branch from 2f21ab2 to 84d7b54 Compare August 19, 2024 10:08
@acelaya acelaya marked this pull request as draft August 19, 2024 10:16
@acelaya acelaya marked this pull request as ready for review August 19, 2024 10:33
@acelaya acelaya requested a review from robertknight August 19, 2024 10:34
Copy link
Member

@robertknight robertknight left a comment

Choose a reason for hiding this comment

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

LGTM. The check definitely seems more visually obvious than the red bar.

@@ -99,11 +99,10 @@ function SelectOption<T>({
<li
className={classnames(
'w-full ring-inset outline-none rounded-none select-none',
'border-t first:border-t-0 whitespace-nowrap',
'px-1 mb-1 first:mt-1 whitespace-nowrap group',
Copy link
Member

Choose a reason for hiding this comment

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

This is fine, but can you clarify how this makes adding the search boxes easier?

@acelaya acelaya merged commit 7a9d5d3 into main Aug 19, 2024
4 checks passed
@acelaya acelaya deleted the select-new-design branch August 19, 2024 11:15
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.

2 participants