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 configurable header styles to Blank Canvas Blocks #3439

Merged
merged 2 commits into from
Mar 10, 2021

Conversation

pbking
Copy link
Contributor

@pbking pbking commented Mar 9, 2021

Part of #3413 (for headings)

Added a custom headings configuration block including font-weight, -height, and -family and set the values to what they are in Blank Canvas.

Mapped font-family and font-weight to those properties to all h elements (h1-h6) in scss.

Refactored 'line-height' out of 'custom'

  • for body just moves it to the basic typography object as it doesn't appear to be used elsewhere
  • for header moved it into custom object specifically for heading block configuration and mapped that to the header blocks. (This keeps all the "custom headings configuration" in one place)

Set the header font size values in theme.json to the same size values in Blank Canvas

Before:
image

After:
image

Copy link
Contributor

@jffng jffng left a comment

Choose a reason for hiding this comment

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

This LGTM!

Just one comment that is more general — it seems we're leaning towards using the hyphenated CSS attribute name in our custom variables. When it's generated by theme.json / global styles mechanism proper, though, camel case is used.

Do we want to make these consistent, or is it better to leave them hyphenated so we know which variables we're creating via the "custom" section?

@MaggieCabrera
Copy link
Contributor

Do we want to make these consistent, or is it better to leave them hyphenated so we know which variables we're creating via the "custom" section?

Good point! I think we should use camel case for consistency, we are already adding the --wp--custom prefix to all of our custom variables anyway

}
},
"core/heading/h2": {
"typography": {
"fontSize": "var(--wp--preset--font-size--huge)",
"lineHeight": "var(--wp--custom--line-height--headings)"
"fontSize": "32px",
Copy link
Contributor

Choose a reason for hiding this comment

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

why are we not using variables for h1 and h2 like we are doing for the rest?

Copy link
Contributor Author

@pbking pbking Mar 10, 2021

Choose a reason for hiding this comment

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

Because those sizes exceeded what was configured as font size. I wasn't sure if it was a good idea to add two more sizes, which seem more focused on paragraph styles, just to style the larger header elements.

Copy link
Contributor

Choose a reason for hiding this comment

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

I lean towards not adding more variables for headings, since we have the ability to change it directly in the global styles supported style properties of heading blocks.

Unless these font sizes would be used again outside the H1 + H2. Now that I think about it, they might for a block like site title... Hmm.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's more of a decision at the "theme" level then the "polyfill" level and those additional variables certainly could be added by that theme (or this one if we decide to style the block title in that way).
Don't code it 'till ya need it.

@pbking
Copy link
Contributor Author

pbking commented Mar 10, 2021

Good point y'all. Refactored for consistency.
I'll keep an eye on that in the future.

@jffng
Copy link
Contributor

jffng commented Mar 10, 2021

Once merge conflicts are resolved this LGTM! Thanks for the follow up on consistency in the key names.

@pbking pbking force-pushed the add/bcb-header-styles branch from 74c2971 to a253021 Compare March 10, 2021 18:48
@pbking pbking merged commit 7155217 into make/blank-canvas-blocks Mar 10, 2021
@pbking pbking deleted the add/bcb-header-styles branch March 25, 2021 13:34
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