-
Notifications
You must be signed in to change notification settings - Fork 4.3k
/
Copy pathindex.js
36 lines (32 loc) · 977 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/**
* External dependencies
*/
import classnames from 'classnames';
import { isString } from 'lodash';
/**
* Internal dependencies
*/
import Dashicon from '../dashicon';
/**
* Renders a placeholder. Normally used by blocks to render their empty state.
*
* @param {Object} props The component props.
* @return {Object} The rendered placeholder.
*/
function Placeholder( { icon, children, label, instructions, className, notices, ...additionalProps } ) {
const classes = classnames( 'components-placeholder', className );
return (
<div { ...additionalProps } className={ classes }>
{ notices }
<div className="components-placeholder__label">
{ isString( icon ) ? <Dashicon icon={ icon } /> : icon }
{ label }
</div>
{ !! instructions && <div className="components-placeholder__instructions">{ instructions }</div> }
<div className="components-placeholder__fieldset">
{ children }
</div>
</div>
);
}
export default Placeholder;