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

Blog Post Block: Fix grid so items are aligned when an odd number of posts are inserted #1173

Merged
merged 1 commit into from
Jun 16, 2022

Conversation

vykes-mac
Copy link
Contributor

@vykes-mac vykes-mac commented Jun 15, 2022

All Submissions:

Blog post block uses a flexbox to render items in a grid and use justify-content: space between to determine how the items are laid out. This however causes the flexbox to force empty space between some items when there is an odd number of items in the grid. This fix changes how items are laid out using justify-content: flex-start so items are properly aligned when rendered and instead of allowing flexbox to determine the space we specify a gap between each item.

Changes proposed in this Pull Request:

Closes #1171.
Original issue Automattic/wp-calypso#62318

How to test the changes in this Pull Request:

  1. Create a number of posts (about 5)
  2. Create another post and add Blog Post Block with the posts created from 1 above. use a 3 * 3 grid
  3. Verify the posts are properly aligned with no empty space between.

Before:
Markup 2022-03-28 at 13 03 55

After:
Screenshot 2022-06-15 at 6 14 29 PM

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?

@vykes-mac vykes-mac requested a review from a team as a code owner June 15, 2022 23:15
@wojtekn wojtekn self-requested a review June 16, 2022 10:09
@wojtekn wojtekn assigned wojtekn and vykes-mac and unassigned wojtekn Jun 16, 2022
@adekbadek
Copy link
Member

@wojtekn did you want to sign off here?

@wojtekn
Copy link

wojtekn commented Jun 16, 2022

@adekbadek I started testing this one but was stuck with newspack -> calypso flow.

I don't want to block it, so if all is good for you, let's ship it.

@adekbadek adekbadek merged commit 7139567 into master Jun 16, 2022
@adekbadek adekbadek deleted the fix/grid-rendering branch June 16, 2022 13:16
matticbot pushed a commit that referenced this pull request Jun 16, 2022
# [1.53.0-alpha.1](v1.52.0...v1.53.0-alpha.1) (2022-06-16)

### Bug Fixes

* **donate:** amount formatting ([c766ce3](c766ce3))
* **homepage posts block:** align items when an odd number of items is inserted ([#1173](#1173)) ([7139567](7139567))
* **iframe-block:** handle errors from server-side fetch ([#1162](#1162)) ([8378b41](8378b41))
* make sure block exists before unregistering ([#1169](#1169)) ([6d3deed](6d3deed))

### Features

* unregister the Jetpack Donation block ([#1163](#1163)) ([6acbcac](6acbcac))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 1.53.0-alpha.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

matticbot pushed a commit that referenced this pull request Jun 27, 2022
# [1.53.0](v1.52.0...v1.53.0) (2022-06-27)

### Bug Fixes

* **donate:** amount formatting ([c766ce3](c766ce3))
* **homepage posts block:** align items when an odd number of items is inserted ([#1173](#1173)) ([7139567](7139567))
* **iframe-block:** handle errors from server-side fetch ([#1162](#1162)) ([8378b41](8378b41))
* make sure block exists before unregistering ([#1169](#1169)) ([6d3deed](6d3deed))

### Features

* unregister the Jetpack Donation block ([#1163](#1163)) ([6acbcac](6acbcac))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 1.53.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.

Blog Posts Block: Renders unnecessary space between posts when theirs an odd number of posts.
4 participants