From 4bafbe26ed8230f69daaefdcdc08ce62b440980f Mon Sep 17 00:00:00 2001 From: Jon Surrell Date: Thu, 25 Apr 2019 17:48:51 +0200 Subject: [PATCH] Pull srcsetMinWidth into const --- extensions/blocks/tiled-gallery/utils/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/extensions/blocks/tiled-gallery/utils/index.js b/extensions/blocks/tiled-gallery/utils/index.js index e4a9bdf955a8a..1fbb4bb44352f 100644 --- a/extensions/blocks/tiled-gallery/utils/index.js +++ b/extensions/blocks/tiled-gallery/utils/index.js @@ -67,13 +67,15 @@ export function photonizedImgProps( img, galleryAtts = {} ) { /** * Build a sensible `srcSet` that will let the browser get an optimized image based on - * viewport width + * viewport width. */ const step = 300; + const srcsetMinWith = 600; + let srcSet; if ( isSquareishLayout( layoutStyle ) ) { - const minWidth = Math.min( 600, width, height ); + const minWidth = Math.min( srcsetMinWith, width, height ); const maxWidth = Math.min( PHOTON_MAX_RESIZE, width, height ); srcSet = range( minWidth, maxWidth, step ) @@ -87,7 +89,7 @@ export function photonizedImgProps( img, galleryAtts = {} ) { .filter( Boolean ) .join( ',' ); } else { - const minWidth = Math.min( 600, width ); + const minWidth = Math.min( srcsetMinWith, width ); const maxWidth = Math.min( PHOTON_MAX_RESIZE, width ); srcSet = range( minWidth, maxWidth, step )