Skip to content

Commit

Permalink
Add no results message
Browse files Browse the repository at this point in the history
  • Loading branch information
glendaviesnz committed Sep 13, 2023
1 parent da77818 commit 8b94003
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions packages/block-editor/src/components/inserter/block-patterns-tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,6 @@ export function BlockPatternsCategoryPanel( {
// Hide block pattern preview on unmount.
useEffect( () => () => onHover( null ), [] );

if ( ! currentCategoryPatterns.length ) {
return null;
}

return (
<div
className="block-editor-inserter__patterns-category-panel"
Expand All @@ -283,18 +279,23 @@ export function BlockPatternsCategoryPanel( {
{ patternFilter === PATTERN_TYPES.user && (
<BlockPatternsSyncFilter />
) }
<BlockPatternList
shownPatterns={ pagingProps.categoryPatternsAsyncList }
blockPatterns={ pagingProps.categoryPatterns }
onClickPattern={ onClickPattern }
onHover={ onHover }
label={ category.label }
orientation="vertical"
category={ category.name }
isDraggable
showTitlesAsTooltip={ showTitlesAsTooltip }
patternFilter={ patternFilter }
/>
{ ! currentCategoryPatterns.length && (
<div>{ __( 'No results found' ) }</div>
) }
{ currentCategoryPatterns.length > 0 && (
<BlockPatternList
shownPatterns={ pagingProps.categoryPatternsAsyncList }
blockPatterns={ pagingProps.categoryPatterns }
onClickPattern={ onClickPattern }
onHover={ onHover }
label={ category.label }
orientation="vertical"
category={ category.name }
isDraggable
showTitlesAsTooltip={ showTitlesAsTooltip }
patternFilter={ patternFilter }
/>
) }
{ pagingProps.numPages > 1 && (
<BlockPatternsPaging { ...pagingProps } />
) }
Expand Down

0 comments on commit 8b94003

Please sign in to comment.