From 06a4f8c8f635948ceb2861b98f54e94ce1d7aa47 Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Fri, 15 Dec 2017 09:58:33 -0500 Subject: [PATCH] Inserter: Show messaging when no blocks found --- editor/components/inserter/menu.js | 9 +++++++++ editor/components/inserter/style.scss | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/editor/components/inserter/menu.js b/editor/components/inserter/menu.js index 2d91af86dc5e1..b86487293aea3 100644 --- a/editor/components/inserter/menu.js +++ b/editor/components/inserter/menu.js @@ -11,6 +11,7 @@ import { pick, some, sortBy, + isEmpty, } from 'lodash'; import { connect } from 'react-redux'; @@ -255,6 +256,14 @@ export class InserterMenu extends Component { } renderCategories( visibleBlocksByCategory ) { + if ( isEmpty( visibleBlocksByCategory ) ) { + return ( + + { __( 'No blocks found' ) } + + ); + } + return getCategories().map( ( category ) => this.renderCategory( category, visibleBlocksByCategory[ category.slug ] ) ); diff --git a/editor/components/inserter/style.scss b/editor/components/inserter/style.scss index deb835e931290..280a9df45f450 100644 --- a/editor/components/inserter/style.scss +++ b/editor/components/inserter/style.scss @@ -115,6 +115,13 @@ input[type="search"].editor-inserter__search { overflow: auto; } +.editor-inserter__no-results { + display: block; + text-align: center; + font-style: italic; + padding: 8px; +} + .editor-inserter__tabs { display: flex; flex-direction: column;