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

Add graphical empty state into block inserter #17326

Closed
9 changes: 8 additions & 1 deletion packages/block-editor/src/components/inserter/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import {
PanelBody,
withSpokenMessages,
Tip,
Path,
SVG,
} from '@wordpress/components';
import {
getCategories,
Expand Down Expand Up @@ -356,7 +358,12 @@ export class InserterMenu extends Component {
</PanelBody>
) }
{ isEmpty( suggestedItems ) && isEmpty( reusableItems ) && isEmpty( itemsPerCategory ) && (
<p className="editor-inserter__no-results block-editor-inserter__no-results">{ __( 'No blocks found.' ) }</p>
<p className="editor-inserter__no-results block-editor-inserter__no-results">
<SVG width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<Path d="M8 10c0-2.21 1.79-4 4-4s4 1.79 4 4c0 1.283-.79 1.973-1.56 2.646C13.712 13.283 13 13.905 13 15h-2c0-1.821.942-2.543 1.77-3.178.65-.498 1.23-.943 1.23-1.822 0-1.1-.9-2-2-2s-2 .9-2 2H8zM13 16v2h-2v-2h2z" fill="#6c7781" />
</SVG>
{ __( 'No blocks found.' ) }
</p>
) }
</div>
</div>
Expand Down
24 changes: 22 additions & 2 deletions packages/block-editor/src/components/inserter/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ $block-inserter-search-height: 38px;
}

.block-editor-inserter__main-area {
width: auto;
width: 100%;
display: flex;
flex-direction: column;
height: 100%;
Expand Down Expand Up @@ -89,6 +89,8 @@ $block-inserter-search-height: 38px;
}

.block-editor-inserter__results {
display: flex;
truchot marked this conversation as resolved.
Show resolved Hide resolved
flex-direction: column;
flex-grow: 1;
overflow: auto;
position: relative;
Expand All @@ -107,6 +109,10 @@ $block-inserter-search-height: 38px;
[role="presentation"] + .components-panel__body {
border-top: none;
}

.components-panel__body {
width: 100%;
}
}

.block-editor-inserter__popover .block-editor-block-types-list {
Expand All @@ -123,9 +129,23 @@ $block-inserter-search-height: 38px;
}

.block-editor-inserter__no-results {
font-style: italic;
padding: 24px;
text-align: center;
color: $dark-gray-500;
margin: auto;

& > svg {
display: block;
width: 24px;
height: 24px;
padding: $grid-size-xlarge $grid-size-xlarge + $grid-size-large;
margin-left: auto;
margin-right: auto;
border-radius: $radius-round-rectangle;
border: $border-width dashed $dark-gray-150;
margin-bottom: $grid-size-large;
box-sizing: content-box;
}
}

.block-editor-inserter__child-blocks {
Expand Down