Skip to content

Commit

Permalink
Show block description for gallery block for 0 images (#2924)
Browse files Browse the repository at this point in the history
* Show block description for gallery block regardless of how many images are selected
  • Loading branch information
StuartFeldt authored and youknowriad committed Oct 9, 2017
1 parent 27cd1f5 commit 87cfefb
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions blocks/library/gallery/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,22 @@ class GalleryBlock extends Component {
const { attributes, focus, className } = this.props;
const { images, columns = defaultColumnsNumber( attributes ), align, imageCrop, linkTo } = attributes;

const blockDescription = (
<BlockDescription>
<p>
{__( 'Image galleries are a great way to share groups of pictures on your site.' )}
</p>
</BlockDescription>
);

const inspectorControls = (
focus && (
<InspectorControls key="inspector">
{blockDescription}
</InspectorControls>
)
);

const controls = (
focus && (
<BlockControls key="controls">
Expand Down Expand Up @@ -133,6 +149,7 @@ class GalleryBlock extends Component {

return [
controls,
inspectorControls,
<Placeholder
key="placeholder"
instructions={ __( 'Drag images here or insert from media library' ) }
Expand Down Expand Up @@ -165,9 +182,7 @@ class GalleryBlock extends Component {
controls,
focus && images.length > 1 && (
<InspectorControls key="inspector">
<BlockDescription>
<p>{ __( 'Image galleries are a great way to share groups of pictures on your site.' ) }</p>
</BlockDescription>
{blockDescription}
<h3>{ __( 'Gallery Settings' ) }</h3>
<RangeControl
label={ __( 'Columns' ) }
Expand Down

0 comments on commit 87cfefb

Please sign in to comment.