diff --git a/packages/block-editor/src/components/block-patterns-list/index.js b/packages/block-editor/src/components/block-patterns-list/index.js
index ec2aad3da2b7a4..971cf8f44a17f0 100644
--- a/packages/block-editor/src/components/block-patterns-list/index.js
+++ b/packages/block-editor/src/components/block-patterns-list/index.js
@@ -8,6 +8,7 @@ import {
__unstableUseCompositeState as useCompositeState,
__unstableCompositeItem as CompositeItem,
Tooltip,
+ __experimentalTruncate as Truncate,
} from '@wordpress/components';
import { useInstanceId } from '@wordpress/compose';
import { __ } from '@wordpress/i18n';
@@ -25,6 +26,17 @@ const WithToolTip = ( { showTooltip, title, children } ) => {
return <>{ children }>;
};
+function BlockPatternItemPlaceholder( { title } ) {
+ return (
+
+ { title }
+
+ { __( '(Empty pattern)' ) }
+
+
+ );
+}
+
function BlockPattern( {
isDraggable,
pattern,
@@ -37,6 +49,7 @@ function BlockPattern( {
const { blocks, viewportWidth } = pattern;
const instanceId = useInstanceId( BlockPattern );
const descriptionId = `block-editor-block-patterns-list__item-description-${ instanceId }`;
+ const isEmpty = ! blocks?.length;
return (
-
+ { ! isEmpty ? (
+
+ ) : (
+
+ ) }
+
{ ! showTooltip && (
{ pattern.title }
diff --git a/packages/block-editor/src/components/block-patterns-list/style.scss b/packages/block-editor/src/components/block-patterns-list/style.scss
index ab80fc71d36dfe..baf32496aaa524 100644
--- a/packages/block-editor/src/components/block-patterns-list/style.scss
+++ b/packages/block-editor/src/components/block-patterns-list/style.scss
@@ -19,6 +19,24 @@
.block-editor-block-patterns-list__item {
height: 100%;
+ .block-editor-block-patterns-list__empty-item {
+ min-height: 60px;
+ display: flex;
+ flex-flow: column;
+ align-items: center;
+ justify-content: center;
+ color: $gray-600;
+ border: 1px solid $gray-400;
+ padding: $grid-unit-10;
+ border-radius: 4px;
+ }
+
+ .block-editor-block-patterns-list__empty-item-text {
+ margin-top: $grid-unit-10;
+ font-size: 11px;
+ display: inline-block;
+ }
+
.block-editor-block-preview__container {
display: flex;
align-items: center;
@@ -32,10 +50,12 @@
text-align: center;
}
+ &:hover .block-editor-block-patterns-list__empty-item,
&:hover .block-editor-block-preview__container {
box-shadow: 0 0 0 2px var(--wp-admin-theme-color);
}
+ &:focus .block-editor-block-patterns-list__empty-item,
&:focus .block-editor-block-preview__container {
@include button-style-outset__focus(var(--wp-admin-theme-color));
}