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

Gallery block: add gap support #34608

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion packages/block-library/src/gallery/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,13 @@
},
"supports": {
"anchor": true,
"align": true
"align": true,
"spacing": {
"blockGap": true,
"__experimentalDefaultControls": {
"blockGap": true
}
}
},
"editorStyle": "wp-block-gallery-editor",
"style": "wp-block-gallery"
Expand Down
4 changes: 4 additions & 0 deletions packages/block-library/src/gallery/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

// Styles for current version of gallery block.
.wp-block-gallery.has-nested-images {
--gallery-block--gutter-size: var(
--wp--style--block-gap,
$blocks-block__margin
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this fallback value be #{$grid-unit-20} for consistency with the other fallback values below? I think $blocks-block__margin is a Sass variable used only in the Button/Buttons blocks?

Also, it looks like the linting is complaining about the formatting:

[3] packages/block-library/src/gallery/style.scss
[3]  6:30  ✖  Expected newline after ":" with a multi-line declaration   declaration-colon-newline-after  
[3]  6:36  ✖  Unexpected whitespace after "("                            function-parentheses-space-inside
[3]  7:25  ✖  Expected single space after ","                            function-comma-space-after       
[3]  9:1   ✖  Unexpected whitespace before ")"                           function-parentheses-space-inside

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should this fallback value be #{$grid-unit-20} for consistency with the other fallback values below? I think $blocks-block__margin is a Sass variable used only in the Button/Buttons blocks?

🤦 Doh, thanks, was a bit confused there - have tidied it up so that the correct fallback $grid-unit-20 is used and it is just declared in one place

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks @glendaviesnz! I think this one also needs the interpolation syntax to render the fallback Sass value. In the CSS the Sass variable is being rendered as-is, instead of being swapped out for the real value:

image

So it'd be #{$grid-unit-20} instead of $grid-unit-20, which should result in the following:

image

);
display: flex;
flex-wrap: wrap;
// Need bogus :not(#individual-image) to override long :not()
Expand Down