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

UnitControl: Add flag for larger default size #40627

Merged
merged 3 commits into from
Apr 28, 2022
Merged

UnitControl: Add flag for larger default size #40627

merged 3 commits into from
Apr 28, 2022

Conversation

mirka
Copy link
Member

@mirka mirka commented Apr 26, 2022

Part of #39397

What?

Adds the temporary prop __next36pxDefaultSize to opt into the new 36px height default size.

Why?

As part of the effort to move toward consistent component sizes.

How?

Details of the migration plan are written in the original issue #39397.

Testing Instructions

  1. npm run storybook:dev
  2. Go to the story for UnitControl. By setting the __next36pxDefaultSize control to true, the height of the default size variant should increase to 36px. All other size variants are unchanged.

Screenshots or screencast

Old default height

Old default height

New default height (opt-in for now)

New default height

@mirka mirka added the [Package] Components /packages/components label Apr 26, 2022
@mirka mirka requested a review from ajitbohra as a code owner April 26, 2022 14:39
@mirka mirka self-assigned this Apr 26, 2022
Comment on lines +29 to +33
const paddingStyles = ( { disableUnits }: InputProps ) => {
if ( disableUnits ) return '';

return css`
${ rtl( paddings[ size ] )() };
${ rtl( { paddingRight: 8 } )() };
Copy link
Member Author

Choose a reason for hiding this comment

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

I simplified the logic here to capture the intent better. Basically, we want the padding-right to always be 8px when units are enabled. Otherwise, it simply inherits from the paddings that InputControl specifies.

Copy link
Contributor

Choose a reason for hiding this comment

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

Love this, so much easier to read!

Not for this PR, but I wonder if we should specify these amounts using the space utility (i.e. multiples of 4) — we should probably do an overhaul of the config before that, though.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, good point. I think we're supposed to move to this final design for the unit dropdown eventually, so maybe that would be a good time to clean up 👇

Final UnitControl design with a larger unit dropdown

Copy link
Contributor

@ciampo ciampo left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

Comment on lines +29 to +33
const paddingStyles = ( { disableUnits }: InputProps ) => {
if ( disableUnits ) return '';

return css`
${ rtl( paddings[ size ] )() };
${ rtl( { paddingRight: 8 } )() };
Copy link
Contributor

Choose a reason for hiding this comment

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

Love this, so much easier to read!

Not for this PR, but I wonder if we should specify these amounts using the space utility (i.e. multiples of 4) — we should probably do an overhaul of the config before that, though.

Base automatically changed from input-control-36px to trunk April 28, 2022 11:38
@mirka mirka force-pushed the unit-control-36px branch from cf37ecf to 695b9f2 Compare April 28, 2022 11:41
@mirka mirka merged commit 04d733d into trunk Apr 28, 2022
@mirka mirka deleted the unit-control-36px branch April 28, 2022 13:12
@github-actions github-actions bot added this to the Gutenberg 13.2 milestone Apr 28, 2022
@georgeh georgeh added the [Type] Enhancement A suggestion for improvement. label May 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Components /packages/components [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants