@wordpress/ui: use semantic dimension tokens#74557
Conversation
|
Size Change: 0 B Total Size: 2.98 MB ℹ️ View Unchanged
|
d322d63 to
6577dc2
Compare
|
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. |
aduth
left a comment
There was a problem hiding this comment.
LGTM 👍 Nice clean-up.
I wonder now if we should consider getting rid of --wpds-dimension-base altogether? It feels like it's a primitive token value where in other token groupings (color) we've eliminated those from the public API. And after these changes, we're no longer using it anywhere in our own code.
| padding-inline: calc(4 * var(--wpds-dimension-base)); /* TODO: Use or create new control/interactive padding token */ | ||
| height: calc(12 * var(--wpds-dimension-base)); /* TODO: Can we eliminate or hard-code? */ | ||
| padding-inline: var(--wpds-dimension-padding-lg); | ||
| height: 48px; |
There was a problem hiding this comment.
I think it's okay and there's precedent for hard-coding, though wonder if we could achieve something equivalent through padding and typography. Maybe even something calc'd with 1lh and padding tokens?
There was a problem hiding this comment.
Deriving the height indirectly feels a little brittle, as it could change based on font size — while I believe we do explicitly want 48px high tab buttons (@jameskoster to confirm here). So maybe, in this scenario, it is better to keep the explicit height?
Although we may want to swap it for a "height" dimension token, if/when those are added?
There was a problem hiding this comment.
I've added TODO comments re. potentially switching to size/height dimension tokens, when available.
Although I see @jameskoster is adding some more references in #75174 😄 @jameskoster Do you think it's possible to avoid using it there, e.g. using hard-coded values or an approach similar to suggested above? Maybe this ties into related discussion of height tokens like in #75101 ? |
I agree that in principle we may want to remove |
f344dec to
1d3cdca
Compare
|
Going to merge for now, we can always iterate in follow-ups as needed. |
1d3cdca to
f4be6e3
Compare
* Button: use dimension tokens * InputLayou: use semantic dimension tokens * Tabs: use semantic dimension tokens * CHANGELOG * Add TODOs for using dimension tokens for height/size * Prevent hardcoded value ---- Co-authored-by: ciampo <mciampini@git.wordpress.org> Co-authored-by: aduth <aduth@git.wordpress.org>
What?
Follow up to #74415 (comment)
Follow up to #74652
Follow up to #74313
Follow up to #75054
Why?
With #75054 merged, this PR refactor styles in the
@wordpress/uiso that semantic dimension tokens are used instead of explicit multiples of the--wpds-dimension-basetokenHow?
Swapped CSS variables with the correct one when applicable, otherwise used a hardcoded value
Testing Instructions
Make sure all affected components (
Button,InputLayou,Tabs) look the same as on trunk