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

Show block description for gallery block for 0 images #2924

Merged
merged 2 commits into from
Oct 9, 2017
Merged
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
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