WordPress / wporg-parent-2021

21 stars 11 forks source link

Element styles: Add margin to h2 & h3 #83

Closed ryelle closed 1 year ago

ryelle commented 1 year ago

This moves the heading margin from theme.json, where it only applied to real content (articles in docs), but not content from patterns (the page content on the main site). Now the margin is applied to all h2s and h3s without custom font sizes (if a font size is added and a margin is necessary, it can be added in the editor too).

See https://github.com/WordPress/wporg-main-2022/issues/246 This is an alternative to https://github.com/WordPress/wporg-main-2022/pull/251, assuming these values should cascade to all pages on the site. If the margins should only apply to the current pages, the in-content approach of 251 makes more sense, but since the same values are used on Documentation, I thought it should be provided by the parent theme.

Screenshots

Ran blink-diff across screenshots. The first screenshot is trunk, the last is this PR, and the middle highlights differences. The only difference is the spacing on About - Philosophy & About - Requirements.

result-home-1280 result-download-1280 result-dl-releases-1280

result-about-1280 result-about-philosophy-1280 result-about-requirements-1280

result-docs-home-1280 result-docs-topic-landing-1280 result-docs-category-1280 result-docs-article-1280

How to test the changes in this Pull Request:

  1. Pull down the branch and build the styles yarn workspaces run build
  2. Spin up a child theme site (see step 5 in docs setup or main setup for testing with a real child theme) or push to a sandbox.
  3. Any pages with plain h2 & h3 should have spacing, for example articles on Documentation or pages in the About section
  4. The spacing does not affect other existing pages (generally because they've got custom font sizes)