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 'No Preview Available' text to the inserter preview panel #17848

Merged
merged 2 commits into from
Oct 10, 2019
Merged
Show file tree
Hide file tree
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
12 changes: 8 additions & 4 deletions packages/block-editor/src/components/inserter/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,8 @@ export class InserterMenu extends Component {
{ ! isReusableBlock( hoveredItem ) && (
<BlockCard blockType={ hoveredItemBlockType } />
) }
{ ( isReusableBlock( hoveredItem ) || hoveredItemBlockType.example ) && (
<div className="block-editor-inserter__preview">
<div className="block-editor-inserter__preview">
{ ( isReusableBlock( hoveredItem ) || hoveredItemBlockType.example ) ? (
<div className="block-editor-inserter__preview-content">
<BlockPreview
padding={ 10 }
Expand All @@ -405,8 +405,12 @@ export class InserterMenu extends Component {
}
/>
</div>
</div>
) }
) : (
<div className="block-editor-inserter__preview-content-missing">
{ __( 'No Preview Available.' ) }
</div>
) }
</div>
</>
) }
{ ! hoveredItem && (
Expand Down
10 changes: 10 additions & 0 deletions packages/block-editor/src/components/inserter/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -227,3 +227,13 @@ $block-inserter-search-height: 38px;
padding: 10px;
}
}

.block-editor-inserter__preview-content-missing {
flex: 1;
display: flex;
justify-content: center;
color: $dark-gray-400;
border: $border-width solid $light-gray-500;
border-radius: $radius-round-rectangle;
align-items: center;
}