This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Product Gallery Thumbnails: Fix overflow issues and improve responsiv…
…eness (#11665) * Product Gallery Thumbnails: Refactor sizing in the editor and the front end * Product Gallery Thumbnails: Change default vertical alignment to top and better control the width of the thumbnails * Product Gallery Thumbnails: Restrict the bottom position thumbnails width based on the total number of thumbnails set * Product Gallery: Remove hardcoded width for Thumbnails and the Large Image and update the width inside of the Dialog * Product Gallery Thumbnails: Introduce thumbnails scaling based on the number of thumbnails * Product Gallery Thumbnails: Fix editor thumbnails scaling * Product Gallery Thumbnails: Remove unused column gap variable * Product Gallery Thumbnails: Fix styling for vertical images * Product Gallery: Remove the unused editor.scss file * Product Gallery: Fix the placement of the Thumbnails block in the block template * Product Gallery Dialog: Reset changes to the dialog * update @wordpress/e2e-test-utils-playwright package * don't update node version * remove waitForSiteEditorFinishLoading function * use visitSiteEditor util * Product Gallery Thumbnails: Add code comments * Product Gallery Thumbnails E2E: Fix the test checking the default position of the thumbnails * Product Gallery E2E: Fix the test checking if the cropping setting works correctly * Product Gallery Thumbnails: Hide the Thumbnails block if there aren't at least 2 thumbnails to display --------- Co-authored-by: Paulo Arromba <[email protected]> Co-authored-by: Luigi Teschio <[email protected]>
- Loading branch information
1 parent
9d234fc
commit bf2ce9e
Showing
10 changed files
with
183 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
2 changes: 2 additions & 0 deletions
2
assets/js/blocks/product-gallery/inner-blocks/product-gallery-large-image/editor.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
.wc-block-editor-product-gallery-large-image { | ||
width: 100%; | ||
|
||
img { | ||
max-width: 100%; | ||
margin: 0 auto; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 26 additions & 13 deletions
39
assets/js/blocks/product-gallery/inner-blocks/product-gallery-thumbnails/editor.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,30 @@ | ||
.wc-block-product-gallery-thumbnails { | ||
width: fit-content; | ||
.wc-block-editor-product-gallery-thumbnails { | ||
display: flex; | ||
flex-flow: column nowrap; | ||
$thumbnails: ".wc-block-editor-product-gallery-thumbnails"; | ||
$thumbnails-gap: 15px; | ||
|
||
&.wc-block-editor-product-gallery-thumbnails--bottom { | ||
flex-flow: row nowrap; | ||
} | ||
#{$thumbnails} { | ||
display: flex; | ||
|
||
img { | ||
width: 100px; | ||
height: 100px; | ||
margin: 5px; | ||
} | ||
.wc-block-product-gallery-thumbnails--position-bottom & { | ||
flex-direction: row; | ||
gap: 0 15px; | ||
} | ||
|
||
.wc-block-product-gallery-thumbnails:not(.wc-block-product-gallery-thumbnails--position-bottom) & { | ||
flex-direction: column; | ||
gap: 15px 0; | ||
} | ||
} | ||
|
||
@for $i from 3 through 8 { | ||
// Calculate the total width occupied by the gaps between thumbnails. | ||
$gap-width: $thumbnails-gap * ($i - 1); | ||
|
||
// Calculate the border width, which is multiplied by 2 to account for both sides of each thumbnail. | ||
$border-width: ($i * 1px * 2); | ||
|
||
$additional-space: $i * 1px; | ||
|
||
.wc-block-product-gallery-thumbnails--number-of-thumbnails-#{$i}:not(.wc-block-product-gallery-thumbnails--position-bottom) { | ||
flex-basis: calc((100% - #{$gap-width} - #{$border-width} - #{$additional-space}) / #{$i}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters