>
);
}
@@ -187,7 +171,7 @@ function PostFeaturedImageDisplay( {
} else {
// We have a Featured image so show a Placeholder if is loading.
image = ! media ? (
- placeholderChip
+ placeholder()
) : (
{ placeholderChip };
+ return
{ placeholder() }
;
}
return ;
}
diff --git a/packages/block-library/src/post-featured-image/editor.scss b/packages/block-library/src/post-featured-image/editor.scss
index 31a77623c335cd..07ed82bf8d64c4 100644
--- a/packages/block-library/src/post-featured-image/editor.scss
+++ b/packages/block-library/src/post-featured-image/editor.scss
@@ -39,21 +39,6 @@
// against any background color.
color: currentColor;
background: transparent;
- &::before {
- content: "";
- display: block;
- position: absolute;
- top: 0;
- right: 0;
- bottom: 0;
- left: 0;
- border: $border-width dashed currentColor;
- opacity: 0.4;
- pointer-events: none;
-
- // Inherit border radius from style variations.
- border-radius: inherit;
- }
// Style the upload button.
.components-placeholder__fieldset {
@@ -82,20 +67,6 @@
color: $white;
}
- // Style the placeholder illustration.
- .components-placeholder__illustration {
- position: absolute;
- top: 0;
- right: 0;
- bottom: 0;
- left: 0;
- width: 100%;
- height: 100%;
- stroke: currentColor;
- stroke-dasharray: 3;
- opacity: 0.4;
- }
-
// Show default placeholder height when not resized.
min-height: 200px;
}
diff --git a/packages/block-library/src/site-logo/edit.js b/packages/block-library/src/site-logo/edit.js
index a08e3520af4b39..176feed44e1268 100644
--- a/packages/block-library/src/site-logo/edit.js
+++ b/packages/block-library/src/site-logo/edit.js
@@ -40,7 +40,6 @@ import {
import { useSelect, useDispatch } from '@wordpress/data';
import { store as coreStore } from '@wordpress/core-data';
import { crop, upload } from '@wordpress/icons';
-import { SVG, Path } from '@wordpress/primitives';
import { store as noticesStore } from '@wordpress/notices';
/**
@@ -520,20 +519,8 @@ export default function LogoEdit( {
- {
-
- }
{ content }
);
diff --git a/packages/block-library/src/site-logo/editor.scss b/packages/block-library/src/site-logo/editor.scss
index ca27e1093b7b16..a6f38428864d43 100644
--- a/packages/block-library/src/site-logo/editor.scss
+++ b/packages/block-library/src/site-logo/editor.scss
@@ -131,20 +131,6 @@
.components-button.components-button > svg {
color: $white;
}
-
- // Style the placeholder illustration.
- .components-placeholder__illustration {
- position: absolute;
- top: 0;
- right: 0;
- bottom: 0;
- left: 0;
- width: 100%;
- height: 100%;
- stroke: currentColor;
- stroke-dasharray: 3;
- opacity: 0.4;
- }
}
// Show upload button on block selection.
diff --git a/packages/components/src/placeholder/README.md b/packages/components/src/placeholder/README.md
index 759883cf358353..85224ca9d23523 100644
--- a/packages/components/src/placeholder/README.md
+++ b/packages/components/src/placeholder/README.md
@@ -11,9 +11,10 @@ const MyPlaceholder = () => ;
### Props
-| Name | Type | Default | Description |
-| ---------------- | ------------------- | ----------- | ----------------------------------------------------------------- |
-| `icon` | `string, WPElement` | `undefined` | If provided, renders an icon next to the label. |
-| `label` | `string` | `undefined` | Renders a label for the placeholder. |
-| `instructions` | `string` | `undefined` | Renders instruction text below label. |
-| `isColumnLayout` | `bool` | `false` | Changes placeholder children layout from flex-row to flex-column. |
+| Name | Type | Default | Description |
+| ---------------- | ------------------- | ----------- | ----------------------------------------------------------------- |
+| `icon` | `string, WPElement` | `undefined` | If provided, renders an icon next to the label. |
+| `label` | `string` | `undefined` | Renders a label for the placeholder. |
+| `instructions` | `string` | `undefined` | Renders instruction text below label. |
+| `isColumnLayout` | `bool` | `false` | Changes placeholder children layout from flex-row to flex-column. |
+| `withIllustration`| `bool` | `false` | Outputs a placeholder illustration. |
diff --git a/packages/components/src/placeholder/index.js b/packages/components/src/placeholder/index.js
index a5a88757249ab4..a4555135f331a1 100644
--- a/packages/components/src/placeholder/index.js
+++ b/packages/components/src/placeholder/index.js
@@ -7,24 +7,38 @@ import classnames from 'classnames';
* WordPress dependencies
*/
import { useResizeObserver } from '@wordpress/compose';
+import { SVG, Path } from '@wordpress/primitives';
/**
* Internal dependencies
*/
import Icon from '../icon';
+const PlaceholderIllustration = (
+
+);
+
/**
* Renders a placeholder. Normally used by blocks to render their empty state.
*
- * @param {Object} props The component props.
- * @param {WPIcon} props.icon An icon rendered before the label.
- * @param {WPElement} props.children Children to be rendered.
- * @param {string} props.label Title of the placeholder.
- * @param {string} props.instructions Instructions of the placeholder.
- * @param {string} props.className Class to set on the container div.
- * @param {Object} props.notices A rendered notices list.
- * @param {Object} props.preview Preview to be rendered in the placeholder.
- * @param {boolean} props.isColumnLayout Whether a column layout should be used.
+ * @param {Object} props The component props.
+ * @param {WPIcon} props.icon An icon rendered before the label.
+ * @param {WPElement} props.children Children to be rendered.
+ * @param {string} props.label Title of the placeholder.
+ * @param {string} props.instructions Instructions of the placeholder.
+ * @param {string} props.className Class to set on the container div.
+ * @param {Object} props.notices A rendered notices list.
+ * @param {Object} props.preview Preview to be rendered in the placeholder.
+ * @param {boolean} props.isColumnLayout Whether a column layout should be used.
+ * @param {boolean} props.withIllustration Whether to add an illustration to the placeholder.
*
* @return {Object} The rendered placeholder.
*/
@@ -37,6 +51,7 @@ function Placeholder( {
notices,
preview,
isColumnLayout,
+ withIllustration,
...additionalProps
} ) {
const [ resizeListener, { width } ] = useResizeObserver();
@@ -55,13 +70,15 @@ function Placeholder( {
const classes = classnames(
'components-placeholder',
className,
- modifierClassNames
+ modifierClassNames,
+ withIllustration ? 'has-illustration' : null
);
const fieldsetClasses = classnames( 'components-placeholder__fieldset', {
'is-column-layout': isColumnLayout,
} );
return (