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

PWA-3217-V1::Thumbnail Images are getting hidden due to PR - BUG#PWA-… #4194

Merged
merged 4 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ exports[`renders form errors 1`] = `
onError={[Function]}
onLoad={[Function]}
sizes="240px"
src="https://master-7rqtwti-c5v7sxvquxwl4.eu-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/s/vsw02-pe_main_2.jpg?auto=webp&format=pjpg&width=240&height=300&fit=cover"
src="https://master-7rqtwti-c5v7sxvquxwl4.eu-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/s/vsw02-pe_main_2.jpg"
srcSet="https://master-7rqtwti-c5v7sxvquxwl4.eu-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/s/vsw02-pe_main_2.jpg?auto=webp&format=pjpg&width=40&height=50&fit=cover 40w,
https://master-7rqtwti-c5v7sxvquxwl4.eu-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/s/vsw02-pe_main_2.jpg?auto=webp&format=pjpg&width=80&height=100&fit=cover 80w,
https://master-7rqtwti-c5v7sxvquxwl4.eu-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/s/vsw02-pe_main_2.jpg?auto=webp&format=pjpg&width=160&height=200&fit=cover 160w,
Expand Down Expand Up @@ -475,7 +475,7 @@ exports[`renders form with data 1`] = `
onError={[Function]}
onLoad={[Function]}
sizes="240px"
src="https://master-7rqtwti-c5v7sxvquxwl4.eu-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/s/vsw02-pe_main_2.jpg?auto=webp&format=pjpg&width=240&height=300&fit=cover"
src="https://master-7rqtwti-c5v7sxvquxwl4.eu-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/s/vsw02-pe_main_2.jpg"
srcSet="https://master-7rqtwti-c5v7sxvquxwl4.eu-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/s/vsw02-pe_main_2.jpg?auto=webp&format=pjpg&width=40&height=50&fit=cover 40w,
https://master-7rqtwti-c5v7sxvquxwl4.eu-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/s/vsw02-pe_main_2.jpg?auto=webp&format=pjpg&width=80&height=100&fit=cover 80w,
https://master-7rqtwti-c5v7sxvquxwl4.eu-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/s/vsw02-pe_main_2.jpg?auto=webp&format=pjpg&width=160&height=200&fit=cover 160w,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ exports[`Snapshot test 1`] = `
onError={[Function]}
onLoad={[Function]}
sizes="100px"
src="https://master-7rqtwti-c5v7sxvquxwl4.eu-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/t/vt12-kh_main_2.jpg?auto=webp&format=pjpg&width=100&height=125&fit=cover"
src="https://master-7rqtwti-c5v7sxvquxwl4.eu-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/t/vt12-kh_main_2.jpg"
srcSet="https://master-7rqtwti-c5v7sxvquxwl4.eu-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/t/vt12-kh_main_2.jpg?auto=webp&format=pjpg&width=40&height=50&fit=cover 40w,
https://master-7rqtwti-c5v7sxvquxwl4.eu-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/t/vt12-kh_main_2.jpg?auto=webp&format=pjpg&width=80&height=100&fit=cover 80w,
https://master-7rqtwti-c5v7sxvquxwl4.eu-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/t/vt12-kh_main_2.jpg?auto=webp&format=pjpg&width=160&height=200&fit=cover 160w,
Expand Down Expand Up @@ -112,7 +112,7 @@ https://master-7rqtwti-c5v7sxvquxwl4.eu-4.magentosite.cloud/media/catalog/produc
onError={[Function]}
onLoad={[Function]}
sizes="100px"
src="https://master-7rqtwti-c5v7sxvquxwl4.eu-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/s/vsw02-pe_main_2.jpg?auto=webp&format=pjpg&width=100&height=125&fit=cover"
src="https://master-7rqtwti-c5v7sxvquxwl4.eu-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/s/vsw02-pe_main_2.jpg"
srcSet="https://master-7rqtwti-c5v7sxvquxwl4.eu-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/s/vsw02-pe_main_2.jpg?auto=webp&format=pjpg&width=40&height=50&fit=cover 40w,
https://master-7rqtwti-c5v7sxvquxwl4.eu-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/s/vsw02-pe_main_2.jpg?auto=webp&format=pjpg&width=80&height=100&fit=cover 80w,
https://master-7rqtwti-c5v7sxvquxwl4.eu-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/s/vsw02-pe_main_2.jpg?auto=webp&format=pjpg&width=160&height=200&fit=cover 160w,
Expand Down Expand Up @@ -188,7 +188,7 @@ https://master-7rqtwti-c5v7sxvquxwl4.eu-4.magentosite.cloud/media/catalog/produc
onError={[Function]}
onLoad={[Function]}
sizes="100px"
src="https://master-7rqtwti-c5v7sxvquxwl4.eu-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/d/vd01-ll_main_2.jpg?auto=webp&format=pjpg&width=100&height=125&fit=cover"
src="https://master-7rqtwti-c5v7sxvquxwl4.eu-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/d/vd01-ll_main_2.jpg"
srcSet="https://master-7rqtwti-c5v7sxvquxwl4.eu-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/d/vd01-ll_main_2.jpg?auto=webp&format=pjpg&width=40&height=50&fit=cover 40w,
https://master-7rqtwti-c5v7sxvquxwl4.eu-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/d/vd01-ll_main_2.jpg?auto=webp&format=pjpg&width=80&height=100&fit=cover 80w,
https://master-7rqtwti-c5v7sxvquxwl4.eu-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/d/vd01-ll_main_2.jpg?auto=webp&format=pjpg&width=160&height=200&fit=cover 160w,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ exports[`renders correctly with valid item data 1`] = `
onError={[MockFunction]}
onLoad={[MockFunction]}
sizes="(max-width: 640px) 300px, 840px"
src="/media/catalog/product/foo/bar/pic.png?auto=webp&format=png&width=100&fit=cover"
src="/foo/bar/pic.png"
srcSet="/media/catalog/product/foo/bar/pic.png?auto=webp&format=png&width=40&height=50&fit=cover 40w,
/media/catalog/product/foo/bar/pic.png?auto=webp&format=png&width=80&height=100&fit=cover 80w,
/media/catalog/product/foo/bar/pic.png?auto=webp&format=png&width=160&height=200&fit=cover 160w,
Expand Down
6 changes: 3 additions & 3 deletions packages/venia-ui/lib/components/Image/resourceImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const ResourceImage = props => {
ratio
});

const { sizes, src, srcSet } = talonProps;
const { sizes, srcSet } = talonProps;
const dimensionAttributes = {};
if (typeof height !== 'undefined') {
dimensionAttributes['--height'] = height + 'px';
Expand All @@ -65,8 +65,8 @@ const ResourceImage = props => {
onError={handleError}
onLoad={handleLoad}
sizes={sizes}
src={src}
srcSet={srcSet}
src={resource}
srcSet={String(className).startsWith('item-image') ? null : srcSet}
width={width}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ exports[`Should disable delete icon while loading 1`] = `
onError={[Function]}
onLoad={[Function]}
sizes="100px"
src="/media/catalog/product/www.venia.com/p1?auto=webp&format=pjpg&width=100&height=125&fit=cover"
src="www.venia.com/p1"
srcSet="/media/catalog/product/www.venia.com/p1?auto=webp&format=pjpg&width=40&height=50&fit=cover 40w,
/media/catalog/product/www.venia.com/p1?auto=webp&format=pjpg&width=80&height=100&fit=cover 80w,
/media/catalog/product/www.venia.com/p1?auto=webp&format=pjpg&width=160&height=200&fit=cover 160w,
Expand Down Expand Up @@ -198,7 +198,7 @@ exports[`Should render correctly 1`] = `
onError={[Function]}
onLoad={[Function]}
sizes="100px"
src="/media/catalog/product/www.venia.com/p1?auto=webp&format=pjpg&width=100&height=125&fit=cover"
src="www.venia.com/p1"
srcSet="/media/catalog/product/www.venia.com/p1?auto=webp&format=pjpg&width=40&height=50&fit=cover 40w,
/media/catalog/product/www.venia.com/p1?auto=webp&format=pjpg&width=80&height=100&fit=cover 80w,
/media/catalog/product/www.venia.com/p1?auto=webp&format=pjpg&width=160&height=200&fit=cover 160w,
Expand Down Expand Up @@ -365,7 +365,7 @@ exports[`Should render correctly when configured to use variant thumbnail 1`] =
onError={[Function]}
onLoad={[Function]}
sizes="100px"
src="/media/catalog/product/www.venia.com/p1-variant1?auto=webp&format=pjpg&width=100&height=125&fit=cover"
src="www.venia.com/p1-variant1"
srcSet="/media/catalog/product/www.venia.com/p1-variant1?auto=webp&format=pjpg&width=40&height=50&fit=cover 40w,
/media/catalog/product/www.venia.com/p1-variant1?auto=webp&format=pjpg&width=80&height=100&fit=cover 80w,
/media/catalog/product/www.venia.com/p1-variant1?auto=webp&format=pjpg&width=160&height=200&fit=cover 160w,
Expand Down Expand Up @@ -532,7 +532,7 @@ exports[`Should render correctly with out of stock product 1`] = `
onError={[Function]}
onLoad={[Function]}
sizes="100px"
src="/media/catalog/product/www.venia.com/p1?auto=webp&format=pjpg&width=100&height=125&fit=cover"
src="www.venia.com/p1"
srcSet="/media/catalog/product/www.venia.com/p1?auto=webp&format=pjpg&width=40&height=50&fit=cover 40w,
/media/catalog/product/www.venia.com/p1?auto=webp&format=pjpg&width=80&height=100&fit=cover 80w,
/media/catalog/product/www.venia.com/p1?auto=webp&format=pjpg&width=160&height=200&fit=cover 160w,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ exports[`should render properly 1`] = `
onError={[Function]}
onLoad={[Function]}
sizes="50px"
src="https://www.venia.com/product1-thumbnail.jpg?auto=webp&format=pjpg&width=50&height=62.5&fit=cover"
src="https://www.venia.com/product1-thumbnail.jpg"
srcSet="https://www.venia.com/product1-thumbnail.jpg?auto=webp&format=pjpg&width=40&height=50&fit=cover 40w,
https://www.venia.com/product1-thumbnail.jpg?auto=webp&format=pjpg&width=80&height=100&fit=cover 80w,
https://www.venia.com/product1-thumbnail.jpg?auto=webp&format=pjpg&width=160&height=200&fit=cover 160w,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,10 @@ const ProductFullDetail = props => {
onSubmit={handleAddToCart}
>
<section className={classes.imageCarousel}>
<Carousel images={mediaGalleryEntries} />
<Carousel
images={mediaGalleryEntries}
smallImage={product.small_image}
/>
</section>
<section className={classes.title}>
<h1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ exports[`renders the Carousel component correctly w/ sorted images 1`] = `
onError={[Function]}
onLoad={[Function]}
sizes="640px"
src="/media/catalog/product/thumbnail1.png?auto=webp&format=png&width=640&height=800&fit=cover"
src="thumbnail1.png"
srcSet="/media/catalog/product/thumbnail1.png?auto=webp&format=png&width=40&height=50&fit=cover 40w,
/media/catalog/product/thumbnail1.png?auto=webp&format=png&width=80&height=100&fit=cover 80w,
/media/catalog/product/thumbnail1.png?auto=webp&format=png&width=160&height=200&fit=cover 160w,
Expand Down Expand Up @@ -271,7 +271,7 @@ exports[`renders the Carousel component correctly w/ sorted images 1`] = `
onError={[Function]}
onLoad={[Function]}
sizes="135px"
src="/media/catalog/product/thumbnail1.png?auto=webp&format=png&width=135&height=170&fit=cover"
src="thumbnail1.png"
srcSet="/media/catalog/product/thumbnail1.png?auto=webp&format=png&width=40&height=50&fit=cover 40w,
/media/catalog/product/thumbnail1.png?auto=webp&format=png&width=80&height=100&fit=cover 80w,
/media/catalog/product/thumbnail1.png?auto=webp&format=png&width=160&height=200&fit=cover 160w,
Expand Down Expand Up @@ -322,7 +322,7 @@ exports[`renders the Carousel component correctly w/ sorted images 1`] = `
onError={[Function]}
onLoad={[Function]}
sizes="135px"
src="/media/catalog/product/thumbnail2.png?auto=webp&format=png&width=135&height=170&fit=cover"
src="thumbnail2.png"
srcSet="/media/catalog/product/thumbnail2.png?auto=webp&format=png&width=40&height=50&fit=cover 40w,
/media/catalog/product/thumbnail2.png?auto=webp&format=png&width=80&height=100&fit=cover 80w,
/media/catalog/product/thumbnail2.png?auto=webp&format=png&width=160&height=200&fit=cover 160w,
Expand Down Expand Up @@ -373,7 +373,7 @@ exports[`renders the Carousel component correctly w/ sorted images 1`] = `
onError={[Function]}
onLoad={[Function]}
sizes="135px"
src="/media/catalog/product/thumbnail3.png?auto=webp&format=png&width=135&height=170&fit=cover"
src="thumbnail3.png"
srcSet="/media/catalog/product/thumbnail3.png?auto=webp&format=png&width=40&height=50&fit=cover 40w,
/media/catalog/product/thumbnail3.png?auto=webp&format=png&width=80&height=100&fit=cover 80w,
/media/catalog/product/thumbnail3.png?auto=webp&format=png&width=160&height=200&fit=cover 160w,
Expand Down Expand Up @@ -424,7 +424,7 @@ exports[`renders the Carousel component correctly w/ sorted images 1`] = `
onError={[Function]}
onLoad={[Function]}
sizes="135px"
src="/media/catalog/product/thumbnail4.png?auto=webp&format=png&width=135&height=170&fit=cover"
src="thumbnail4.png"
srcSet="/media/catalog/product/thumbnail4.png?auto=webp&format=png&width=40&height=50&fit=cover 40w,
/media/catalog/product/thumbnail4.png?auto=webp&format=png&width=80&height=100&fit=cover 80w,
/media/catalog/product/thumbnail4.png?auto=webp&format=png&width=160&height=200&fit=cover 160w,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ exports[`renders root class if not the active Thumbnail 1`] = `
onError={[Function]}
onLoad={[Function]}
sizes="135px"
src="/media/catalog/product/thumbnail.png?auto=webp&format=png&width=135&height=170&fit=cover"
src="thumbnail.png"
srcSet="/media/catalog/product/thumbnail.png?auto=webp&format=png&width=40&height=50&fit=cover 40w,
/media/catalog/product/thumbnail.png?auto=webp&format=png&width=80&height=100&fit=cover 80w,
/media/catalog/product/thumbnail.png?auto=webp&format=png&width=160&height=200&fit=cover 160w,
Expand Down Expand Up @@ -86,7 +86,7 @@ exports[`renders the Thumbnail component correctly 1`] = `
onError={[Function]}
onLoad={[Function]}
sizes="135px"
src="/media/catalog/product/thumbnail.png?auto=webp&format=png&width=135&height=170&fit=cover"
src="thumbnail.png"
srcSet="/media/catalog/product/thumbnail.png?auto=webp&format=png&width=40&height=50&fit=cover 40w,
/media/catalog/product/thumbnail.png?auto=webp&format=png&width=80&height=100&fit=cover 80w,
/media/catalog/product/thumbnail.png?auto=webp&format=png&width=160&height=200&fit=cover 160w,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const IMAGE_WIDTH = 640;
* @returns {React.Element} React carousel component that displays a product image
*/
const ProductImageCarousel = props => {
const { images } = props;
const { images, smallImage } = props;
const { formatMessage } = useIntl();
const talonProps = useProductImageCarousel({
images,
Expand Down Expand Up @@ -87,7 +87,7 @@ const ProductImageCarousel = props => {
image: classes.currentImage_placeholder,
root: classes.imageContainer
}}
src={transparentPlaceholder}
src={smallImage ? smallImage : transparentPlaceholder}
/>
);
}
Expand Down
Loading