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

Masonry: Enable dynamic batches #3875

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

bryamrrr
Copy link
Contributor

@bryamrrr bryamrrr commented Nov 15, 2024

Summary

What changed?

This PR introduces _getModulePositioningConfig, an experimental prop to enable dynamic batch sizes (and Early bailout). This is a way to dynamically set the number of items used to position a multicolumn module

Why?

This will allow us to reduce the whitespace from larger multicolumn modules.

Images confirming we have the correct module and grid sizes.

Screenshot 2024-11-14 at 3 41 41 p m Screenshot 2024-11-14 at 3 41 13 p m

@bryamrrr bryamrrr requested a review from a team as a code owner November 15, 2024 01:32
Comment on lines +718 to +720
const gridSize = getColumnCount({ gutter, columnWidth, width, minCols, layout });

const moduleSize = calculateActualColumnSpan({
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was the tricky part of this implementation. These two values are easy to find in multiColumnLayout.ts, but are not ready at this scope.

  • For grid size, I created a whole new util that abstract the way we calculate the column count from both DefaultLayout and FullWidthLayout (updating those utils to avoid code duplicity too).
  • For moduleSize, I exposed the calculateActualColumnSpan from multiColumnLayout.ts to be able to use it here.

All of this happens also in MasonryV2.

Copy link

netlify bot commented Nov 15, 2024

Deploy Preview for gestalt ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit a2a7ce0
🔍 Latest deploy log https://app.netlify.com/sites/gestalt/deploys/6736a7dacf55470008da08d3
😎 Deploy Preview https://deploy-preview-3875--gestalt.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

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.

1 participant