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

Style engine: add handling of spacing presets #41700

Closed
wants to merge 30 commits into from

Conversation

glendaviesnz
Copy link
Contributor

@glendaviesnz glendaviesnz commented Jun 14, 2022

What?

Adds handling of conversion of spacing preset values to css vars to style engine

Why?

#41527 adds the spacing presets to theme.json, as the first part of implementing standardised design tokens for spacing as detailed in #39371

How?

Extends the existing preset var handling added for the processing of color presets.

Testing Instructions

  • Add the following block markup in the edit code view and save and view in the frontend:
<!-- wp:site-title {"style":{"spacing":{"padding":{"top":"var:preset|spacing|70","right":"var:preset|spacing|50","bottom":"var:preset|spacing|70","left":"var:preset|spacing|50"}},"elements":{"link":{"color":{"text":"var:preset|color|background"}}}},"backgroundColor":"vivid-red"} /-->
  • Check in the frontend that the block markup has converted the var:preset|space|20 values into var(--wp--preset--spacing--20); in the block styles

N.B. The frontend styles markup in this PR is not an indication of the final marking for spacing presets. The final implementation may use utility classes as noted in #39371, but the fact that we are generating these styles dynamically on the frontend means we can modify the output relatively easily as we go.

Screenshots or screencast

Screen Shot 2022-06-14 at 2 42 07 PM

@glendaviesnz glendaviesnz changed the base branch from trunk to add/spacing-sizes-part-1 June 14, 2022 04:11
@glendaviesnz glendaviesnz self-assigned this Jun 14, 2022
@glendaviesnz glendaviesnz changed the title Add/spacing sizes part 2 Style engine: add handling of spacing presets Jun 14, 2022
@glendaviesnz
Copy link
Contributor Author

@ramonjd @andrewserong - have moved the shared css var code into a shared method. I will add some tests before I take it out of draft.

Copy link
Contributor

@andrewserong andrewserong left a comment

Choose a reason for hiding this comment

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

Thanks Glen, that's looking cleaner now with the additional function 👍

Just left a question about naming of the placeholder for the CSS var, but this is looking close to me!

packages/style-engine/class-wp-style-engine.php Outdated Show resolved Hide resolved
@glendaviesnz glendaviesnz marked this pull request as ready for review June 15, 2022 05:13
@glendaviesnz glendaviesnz force-pushed the add/spacing-sizes-part-2 branch from 04427f3 to bd2c53d Compare June 16, 2022 03:46
@glendaviesnz glendaviesnz force-pushed the add/spacing-sizes-part-1 branch from 5d4abcc to e73f921 Compare June 16, 2022 04:58
@glendaviesnz glendaviesnz force-pushed the add/spacing-sizes-part-2 branch 5 times, most recently from 98b67fd to 85476df Compare June 22, 2022 23:43
@glendaviesnz glendaviesnz force-pushed the add/spacing-sizes-part-1 branch from dd77d90 to e23e954 Compare June 23, 2022 05:21
@glendaviesnz glendaviesnz force-pushed the add/spacing-sizes-part-2 branch from 5df63cc to 724852d Compare June 23, 2022 05:25
@glendaviesnz glendaviesnz force-pushed the add/spacing-sizes-part-1 branch from eef6401 to 392b6a4 Compare June 27, 2022 02:38
@glendaviesnz glendaviesnz force-pushed the add/spacing-sizes-part-2 branch from 68a229a to eef6401 Compare June 27, 2022 21:50
@glendaviesnz
Copy link
Contributor Author

Replaced by #41990

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants