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

Homepage Posts: fix column spacing and add control #1245

Merged
merged 5 commits into from
Aug 29, 2022

Conversation

laurelfulford
Copy link
Contributor

@laurelfulford laurelfulford commented Aug 17, 2022

All Submissions:

Changes proposed in this Pull Request:

This PR tackles a couple changes to how the column spacing works with the Homepage Posts block:

Closes #1233, #1213 and #638.

How to test the changes in this Pull Request:

  1. Switch your site to the default Newspack theme -- this makes it easiest to see if the columns span the full space, because the accent header fills the whole space.
  2. Create a post and add an assortment of Homepage Posts blocks to the editor -- you'll want to include all of the different column settings (2-6) with and without borders. You can also copy the following example blocks and paste them into the code view of the editor (it also includes some Homepage Posts in columns to compare the spacing):
Example Homepage Posts blocks
<!-- wp:newspack-blocks/homepage-articles {"showExcerpt":false,"postLayout":"grid","columns":2,"postsToShow":2,"typeScale":3,"sectionHeader":"Two Column via Block Settings"} /-->

<!-- wp:newspack-blocks/homepage-articles {"showExcerpt":false,"postLayout":"grid","columns":2,"typeScale":3,"sectionHeader":"Two Column -  via Block Settings"} /-->

<!-- wp:newspack-blocks/homepage-articles {"className":"is-style-borders","showExcerpt":false,"showAvatar":false,"showCategory":true,"postLayout":"grid","columns":2,"postsToShow":2,"typeScale":3,"sectionHeader":"Two Column - via Block Settings"} /-->

<!-- wp:group -->
<div class="wp-block-group"><!-- wp:heading {"className":"accent-header"} -->
<h2 class="accent-header">Two Columns in Columns</h2>
<!-- /wp:heading -->

<!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column -->
<div class="wp-block-column"><!-- wp:newspack-blocks/homepage-articles {"showExcerpt":false,"postsToShow":1,"typeScale":3} /--></div>
<!-- /wp:column -->

<!-- wp:column -->
<div class="wp-block-column"><!-- wp:newspack-blocks/homepage-articles {"showExcerpt":false,"showAvatar":false,"showCategory":true,"postsToShow":1,"typeScale":3} /--></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

<!-- wp:columns {"className":"is-style-borders"} -->
<div class="wp-block-columns is-style-borders"><!-- wp:column -->
<div class="wp-block-column"><!-- wp:newspack-blocks/homepage-articles {"showExcerpt":false,"postsToShow":1,"typeScale":3} /--></div>
<!-- /wp:column -->

<!-- wp:column -->
<div class="wp-block-column"><!-- wp:newspack-blocks/homepage-articles {"showExcerpt":false,"showAvatar":false,"showCategory":true,"postsToShow":1,"typeScale":3} /--></div>
<!-- /wp:column --></div>
<!-- /wp:columns --></div>
<!-- /wp:group -->

<!-- wp:newspack-blocks/homepage-articles {"showExcerpt":false,"showAvatar":false,"showCategory":true,"postLayout":"grid","typeScale":3,"sectionHeader":"Three Column -  via Block Settings"} /-->

<!-- wp:newspack-blocks/homepage-articles {"className":"is-style-borders","showExcerpt":false,"showAvatar":false,"showCategory":true,"postLayout":"grid","typeScale":3,"sectionHeader":"Three Column -  via Block Settings"} /-->

<!-- wp:newspack-blocks/homepage-articles {"showExcerpt":false,"showAvatar":false,"showCategory":true,"postLayout":"grid","columns":4,"postsToShow":4,"typeScale":3,"sectionHeader":"Four Column"} /-->

<!-- wp:newspack-blocks/homepage-articles {"showExcerpt":false,"postLayout":"grid","columns":4,"postsToShow":6,"typeScale":3,"sectionHeader":"Four Column"} /-->

<!-- wp:newspack-blocks/homepage-articles {"className":"is-style-borders","showExcerpt":false,"showAvatar":false,"showCategory":true,"postLayout":"grid","columns":4,"postsToShow":4,"typeScale":3,"sectionHeader":"Four Column - Via Block Settings"} /-->

<!-- wp:newspack-blocks/homepage-articles {"showExcerpt":false,"showAvatar":false,"postLayout":"grid","columns":5,"postsToShow":5,"typeScale":2,"sectionHeader":"Five Column - Via Column Settings "} /-->

<!-- wp:newspack-blocks/homepage-articles {"className":"is-style-borders","showExcerpt":false,"showAvatar":false,"showCategory":true,"postLayout":"grid","columns":5,"postsToShow":5,"typeScale":2,"sectionHeader":"Five Column - Via Column Settings "} /-->

<!-- wp:newspack-blocks/homepage-articles {"showExcerpt":false,"showAvatar":false,"showCategory":true,"postLayout":"grid","columns":6,"postsToShow":6,"typeScale":2,"sectionHeader":"six Column"} /-->

<!-- wp:newspack-blocks/homepage-articles {"className":"is-style-borders","showExcerpt":false,"showAvatar":false,"showCategory":true,"postLayout":"grid","columns":6,"postsToShow":6,"typeScale":2,"sectionHeader":"six Column"} /-->
  1. Note how the last post in each row of block with borders wraps to a new line in editor:

  2. Publish the page and view on the front end -- note that the posts don't quite fill all of the horizontal space, and that the borders are not evenly spaced:

image

image

image

  1. Compare the Homepage Posts grid display to Homepage Posts in the columns block; note that the spacing is not the same:

Columns:
image

Homepage Posts Block settings:
image

  1. Apply the PR and run npm run build.
  2. Refresh the page; confirm that the blocks now fill the available horizontal space, and the borders are evenly distributed:

image

image

  1. Confirm that the gap between the posts in the Homepage Posts block matches the gap in the Columns block:

Columns:
image

Homepage Posts with grid setting:
image

  1. Test at different screen sizes and confirm things look okay.
  2. Edit the page and confirm the post-wrapping-when-grid-is-on issue is resolved:

image

  1. Review the posts in the editor and confirm there are no display issues.
  2. In the right sidebar, under the Columns number control, confirm that there's now an option to change the Column Gap, and it's defaulted to 'L' (32px). If you switch the block from Grid to Block layout, this option should go away:

image

  1. Edit your block so you have at least one block with an without borders set to the large gap size, at least one block with an without borders set to the medium gap size, and at least one block with an without borders set to the small gap size.
  2. Test the blocks in the editor and on the front end, at different break points; make sure things display as expected:

Large
image

Medium
image

Small
image

Note: The 'image behind' placement, grid layout and border style don't work together, with or without this PR. I've filed a separate issue for this (#1246).

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

Copy link
Contributor

@dkoo dkoo left a comment

Choose a reason for hiding this comment

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

Looking much better, and the new column gap feature works great. 👍

@laurelfulford
Copy link
Contributor Author

Thanks @dkoo! 🙌

@laurelfulford laurelfulford merged commit 9fa6972 into master Aug 29, 2022
@laurelfulford laurelfulford deleted the fix/1213-grid-gap branch August 29, 2022 16:52
matticbot pushed a commit that referenced this pull request Sep 6, 2022
# [1.57.0-alpha.2](v1.57.0-alpha.1...v1.57.0-alpha.2) (2022-09-06)

### Bug Fixes

* correct Donate thank you message alignment ([#1258](#1258)) ([e838e61](e838e61))
* update Homepage Posts grid spacing and add control  ([#1245](#1245)) ([9fa6972](9fa6972))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 1.57.0-alpha.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

matticbot pushed a commit that referenced this pull request Sep 14, 2022
# [1.57.0](v1.56.0...v1.57.0) (2022-09-14)

### Bug Fixes

* add button block class to the Homepage Posts more button ([#1252](#1252)) ([c4d565c](c4d565c))
* correct Donate thank you message alignment ([#1258](#1258)) ([e838e61](e838e61))
* disambiguate users and guest authors in Author List exclusions ([#1154](#1154)) ([c59056b](c59056b))
* **donate:** default value not below minimum donation ([#1248](#1248)) ([368e856](368e856))
* **donate:** use first & last name as default name ([#1255](#1255)) ([105d95b](105d95b))
* re-add excerpt length preview in editor ([#1247](#1247)) ([bdbe86e](bdbe86e))
* update Homepage Posts grid spacing and add control  ([#1245](#1245)) ([9fa6972](9fa6972))

### Features

* handle minimum donation option in Donate block ([#1239](#1239)) ([10dfefe](10dfefe))
* if donation via a prompt, add prompt ID to Stripe payment metadata ([#1253](#1253)) ([b8cb0e9](b8cb0e9))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 1.57.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

Homepage Posts: Grid + Borders causes wrapping in the editor
3 participants