Skip to content

Commit

Permalink
Use "narrow" instead of "mobile" semantics for viewport flag
Browse files Browse the repository at this point in the history
  • Loading branch information
mkevins committed Dec 4, 2019
1 parent e8e486f commit 7fb31dc
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/block-library/src/gallery/gallery.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const TILE_SPACING = 15;

// we must limit displayed columns since readable content max-width is 580px
const MAX_DISPLAYED_COLUMNS = 4;
const MAX_DISPLAYED_COLUMNS_MOBILE = 2;
const MAX_DISPLAYED_COLUMNS_NARROW = 2;

export const Gallery = ( props ) => {
const [ isCaptionSelected, setIsCaptionSelected ] = useState( false );
Expand All @@ -41,7 +41,7 @@ export const Gallery = ( props ) => {
onFocusGalleryCaption,
attributes,
isSelected,
isMobile,
isNarrow,
onFocus,
} = props;

Expand All @@ -51,9 +51,10 @@ export const Gallery = ( props ) => {
images,
} = attributes;

// limit displayed columns based on viewport width
const displayedColumns = isMobile ?
Math.min( columns, MAX_DISPLAYED_COLUMNS_MOBILE ) :
// limit displayed columns when isNarrow is true (i.e. when viewport width is
// less than "small", where small = 600)
const displayedColumns = isNarrow ?
Math.min( columns, MAX_DISPLAYED_COLUMNS_NARROW ) :
Math.min( columns, MAX_DISPLAYED_COLUMNS );

const selectImage = ( index ) => {
Expand Down

0 comments on commit 7fb31dc

Please sign in to comment.