-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
CustomSelectControl: Use styles from SelectControl #42460
Conversation
Size Change: +34 B (0%) Total Size: 1.26 MB
ℹ️ View Unchanged
|
right: $grid-unit-10; | ||
right: $grid-unit-05; | ||
top: 0; | ||
|
||
&:not(.is-next-36px-default-size) { | ||
right: $grid-unit-05; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to remove this conditional for now — you might notice that the spacing after the chevronDown
is slightly different from the one in trunk, when __next36pxDefaultSize=true
. This responsive spacing will be added back in a cleaner way after #42378 lands.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code changes LGTM 🚀
The only differences that I could notice compare to trunk
are:
- the font size used to be
11px
(I believed caused by adding theisSmall
prop to theButton
component), while it's not13px
- the chevron icon to the right is rendered slightly closer to the right border, compared to how it used to be (although that will be likely fixed in a follow-up PR, like explained in this PR's description and in https://github.com/WordPress/gutenberg/pull/42460/files#r921971827)
Kapture.2022-07-15.at.14.12.27.mp4
I'm inclined to approve this PR, and consider the increase in font size an improvement towards consistency across similar select components — WDYT ?
Right, I consider the font size to be a bug fix. It's a side effect of the |
9c1afa5
to
cfc1455
Compare
What?
Reuse the same styling components used in SelectControl for a more consistent design. This replaces the hacky
Button
-based styling that was being used.Why?
This eliminates a bunch of styling inconsistencies between SelectControl and CustomSelectControl, including:
Plus, we get all the size variants for free.
How?
To limit the scope of this PR, the following will be done as follow-up tasks:
chevronDown
icon to the standardsuffix
prop (after InputControl: Add padding wrapper for prefix/suffix #42378 lands).width: 100%
overrides in the codebase.__nextConstrainedWidth
flag, add an official deprecation warning.Testing Instructions
npm run storybook:dev
and see the CustomSelectControl story.__nextUnconstrainedWidth=false
, the width behavior should be the same as in trunk. Basically, the width is 130px by default but can grow if the selected option label is longer than that.__nextUnconstrainedWidth=true
, each size variant should look the same as the ones for SelectControl.Screenshots or screencast
CleanShot.2022-07-15.at.17.52.38.mp4