-
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
Components: Decrease standard padding to 12px #64708
Conversation
Size Change: +61 B (0%) Total Size: 1.77 MB
ℹ️ View Unchanged
|
<InputControlPrefixWrapper> | ||
<Text color={ COLORS.theme.accent } lineHeight={ 1 }> | ||
# | ||
</Text> | ||
</InputControlPrefixWrapper> |
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.
<InputControlPrefixWrapper> | ||
<Text color={ COLORS.theme.accent } lineHeight={ 1 }> | ||
{ abbreviation } | ||
</Text> | ||
</InputControlPrefixWrapper> |
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.
compact: CONFIG.controlPaddingXSmall, | ||
small: CONFIG.controlPaddingXSmall, | ||
default: CONFIG.controlPaddingX, |
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.
paddingLeft: CONFIG.controlPaddingX, | ||
paddingRight: CONFIG.controlPaddingX, |
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.
`, | ||
medium: css` | ||
padding: ${ paddingY } ${ CONFIG.controlPaddingX }; | ||
padding: ${ paddingY } ${ CONFIG.controlPaddingX }px; |
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.
small: 8, | ||
compact: 8, | ||
'__unstable-large': 16, | ||
default: CONFIG.controlPaddingX, |
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.
// These values should be shared with the `controlPaddingX` in ./utils/config-values.js | ||
padding-left: $grid-unit-15; | ||
padding-right: $grid-unit-15; |
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.
@@ -5,14 +5,16 @@ import { space } from './space'; | |||
import { COLORS } from './colors-values'; | |||
|
|||
const CONTROL_HEIGHT = '36px'; | |||
const CONTROL_PADDING_X = '12px'; |
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.
We should soon make a decision about how we want to define our foundational variables — number, string, or function (space()
)? I am kind of leaning toward numbers because it's more versatile. For example we can make most calculations at compile time rather than rely on all the calc()
s at runtime.
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.
Absolutely.
A few considerations that come to mind (more of a brain dump):
- Is this something that should come directly from theming?
- FWIW, I don't think that
calc()
has a big perf impact, browsers should be quite fast at calculating it - Using calc and CSS variables would enable a different style of coding — we would be able to change the value of a variable, instead of re-writing a new formula
-I agree that dealing with numbers is more practical. We could still have an underlying grid system, but we should consider exposing variables/tokens expressing numbers
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Looks good! |
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. Going to approve also given Joen's comment above
🚀
// These values should be shared with TextControl. | ||
controlPaddingX: 12, | ||
controlPaddingXSmall: 8, | ||
controlPaddingXLarge: 12 * 1.3334, // TODO: Deprecate |
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.
If ItemGroup
is the only consumer of this variable, I guess it makes sense to just delete it from the common config and inline the value in ItemGroup
? Also, should we consider aligning ItemGroup
to the rest of the components and have a 12px
padding too?
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.
ItemGroup already does have a 12px padding in the default size, interestingly. We'll probably deprecate the controlPaddingXLarge
variable and the large
size of ItemGroup at the same time.
* Components: Decrease standard padding to 12px * Fixup * Update snapshots * Add changelog * Fixup Co-authored-by: mirka <[email protected]> Co-authored-by: ciampo <[email protected]> Co-authored-by: jasmussen <[email protected]>
What?
Decreases the horizontal padding of input-like components from 16px to 12px, based on the new specs.
See changelog for full list of affected components.
Why?
The 16px padding was a bit excessive in practice, taking up unnecessary space in tighter layouts.
How?
Uses the
controlPaddingX
variable on theCONFIG
object to share the new values. The one exception right now is theTextControl
component, which doesn't use CSS-in-JS. I left a code comment on both ends to remind that it is a shared value.Testing Instructions
See the components in Storybook. Smoke test in the editor.
Please report if you notice instances of editor UI that should've reflected the style changes in this PR but haven't. I found one (#64709) so I did a quick audit, but it didn't seem like there were others.