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

Add compact size variant to InputControl-based components #57398

Merged
merged 2 commits into from
Jan 2, 2024

Conversation

mirka
Copy link
Member

@mirka mirka commented Dec 27, 2023

Part of #46734
Prerequisite for #56388

What?

Adds an explicit compact size variant to InputControl and all the components based on those styles. This variant has 32px height, in line with the new sizing scheme.

Affected components

  • InputControl
  • NumberControl
  • UnitControl
  • SelectControl
  • TreeSelect

Why?

We will sometimes need a compact variant for a smaller footprint.

How?

This size variant is actually identical with the current default size variants. Since they will eventually be superseded by the new 40px default, we need to keep an explicit compact variant.

Testing Instructions

See the Storybook stories for the affected components.

@mirka mirka added [Type] Enhancement A suggestion for improvement. [Package] Components /packages/components labels Dec 27, 2023
@mirka mirka self-assigned this Dec 27, 2023
@mirka mirka requested a review from ajitbohra as a code owner December 27, 2023 14:07
@mirka mirka requested a review from a team December 27, 2023 14:09
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 -33 to -52
const fontSizeStyles = ( { selectSize = 'default' }: SelectProps ) => {
const sizes = {
default: '13px',
small: '11px',
'__unstable-large': '13px',
};

const fontSize = sizes[ selectSize ];
const fontSizeMobile = '16px';

if ( ! fontSize ) return '';

return css`
font-size: ${ fontSizeMobile };

@media ( min-width: 600px ) {
font-size: ${ fontSize };
}
`;
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice 🧹

@mirka mirka merged commit 60bf21e into trunk Jan 2, 2024
57 checks passed
@mirka mirka deleted the add/input-compact branch January 2, 2024 17:55
@github-actions github-actions bot added this to the Gutenberg 17.5 milestone Jan 2, 2024
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.

2 participants