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

Block Library: Flatten width calculation of gallery columns #20690

Merged
merged 2 commits into from
Mar 9, 2020
Merged
Changes from all commits
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
13 changes: 3 additions & 10 deletions packages/block-library/src/gallery/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
// On mobile and responsive viewports, we allow only 1 or 2 columns at the most.
& .blocks-gallery-image,
& .blocks-gallery-item {
width: calc((100% - #{ $grid-unit-20 }) / 2);
width: calc(50% - #{ $grid-unit-20 });

&:nth-of-type(even) {
margin-right: 0;
Expand All @@ -102,15 +102,8 @@
@for $i from 3 through 8 {
&.columns-#{ $i } .blocks-gallery-image,
&.columns-#{ $i } .blocks-gallery-item {
width: calc((100% - #{ $grid-unit-20 } * #{ $i - 1 }) / #{ $i });
margin-right: 16px;

// Rules inside this query are only run by Microsoft Edge.
// Edge miscalculates `calc`, so we have to add some buffer.
// See also https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/15637241/
@supports (-ms-ime-align:auto) {
width: calc((100% - #{ $grid-unit-20 } * #{ $i - 1 }) / #{ $i } - 1px);
}
width: calc(#{ 100% / $i } - #{ $grid-unit-20 * ( $i - 1 ) / $i });
margin-right: $grid-unit-20;
}
}

Expand Down