diff --git a/blocks/editable/style.scss b/blocks/editable/style.scss index 6d1f1277ecb1d..706d697f6c3e7 100644 --- a/blocks/editable/style.scss +++ b/blocks/editable/style.scss @@ -98,44 +98,3 @@ input.editable-format-toolbar__link-input { padding: 10px; flex-grow: 1; } - -/* Block Placeholders */ -.editor-visual-editor__block .is-placeholder { - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - padding: 1em; - min-height: 200px; - text-align: center; - font-family: $default-font; - font-size: $default-font-size; - background: $light-gray-100; -} - -.placeholder__label { - display: flex; - justify-content: center; - font-weight: bold; - margin-bottom: 1em; - - .dashicon { - margin-right: 1ch; - } -} - -.placeholder__fieldset { - display: flex; - flex-direction: row; - width: 100%; - max-width: 280px; -} - -.placeholder__input { - margin-right: 8px; - flex: 1 1 auto; -} - -.placeholder__instructions { - margin-bottom: 1em; -} diff --git a/blocks/library/embed/index.js b/blocks/library/embed/index.js index 54d3d1122d779..40ad09b808239 100644 --- a/blocks/library/embed/index.js +++ b/blocks/library/embed/index.js @@ -1,8 +1,8 @@ /** * WordPress dependencies */ -import Dashicon from 'components/dashicon'; import Button from 'components/button'; +import Placeholder from 'components/placeholder'; /** * Internal dependencies @@ -30,18 +30,12 @@ registerBlock( 'core/embed', { if ( ! url ) { return ( -
-
- - { wp.i18n.__( 'Embed URL' ) } -
-
- - -
-
+ + + + ); } diff --git a/blocks/library/image/index.js b/blocks/library/image/index.js index 0cf5500d3c477..0cace66468552 100644 --- a/blocks/library/image/index.js +++ b/blocks/library/image/index.js @@ -1,8 +1,8 @@ /** * WordPress dependencies */ -import Dashicon from 'components/dashicon'; import Button from 'components/button'; +import Placeholder from 'components/placeholder'; /** * Internal dependencies @@ -79,18 +79,15 @@ registerBlock( 'core/image', { if ( ! url ) { return ( -
-
- - { wp.i18n.__( 'Image' ) } -
-
- { wp.i18n.__( 'Drag image here or insert from media library' ) } -
+ -
+ ); } diff --git a/components/placeholder/index.js b/components/placeholder/index.js new file mode 100644 index 0000000000000..79373be7c877c --- /dev/null +++ b/components/placeholder/index.js @@ -0,0 +1,29 @@ +/** + * External dependencies + */ +import classnames from 'classnames'; + +/** + * Internal dependencies + */ +import './style.scss'; +import Dashicon from 'components/dashicon'; + +function Placeholder( { icon, children, label, instructions, className, ...additionalProps } ) { + const classes = classnames( 'components-placeholder', className ); + + return ( +
+
+ + { label } +
+ { !! instructions &&
{ instructions }
} +
+ { children } +
+
+ ); +} + +export default Placeholder; diff --git a/components/placeholder/style.scss b/components/placeholder/style.scss new file mode 100644 index 0000000000000..d28fea95f215c --- /dev/null +++ b/components/placeholder/style.scss @@ -0,0 +1,40 @@ +.components-placeholder { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + padding: 1em; + min-height: 200px; + text-align: center; + font-family: $default-font; + font-size: $default-font-size; + background: $light-gray-100; +} + +.components-placeholder__label { + display: flex; + justify-content: center; + font-weight: bold; + margin-bottom: 1em; + + .dashicon { + margin-right: 1ch; + } +} + +.components-placeholder__fieldset { + display: flex; + flex-direction: row; + justify-content: center; + width: 100%; + max-width: 280px; +} + +.components-placeholder__input { + margin-right: 8px; + flex: 1 1 auto; +} + +.components-placeholder__instructions { + margin-bottom: 1em; +}