Skip to content

Commit

Permalink
Pull srcsetMinWidth into const
Browse files Browse the repository at this point in the history
  • Loading branch information
sirreal committed Apr 29, 2019
1 parent 1550ac3 commit 4bafbe2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions extensions/blocks/tiled-gallery/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand All @@ -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 )
Expand Down

0 comments on commit 4bafbe2

Please sign in to comment.