@wordpress/edit-post
Version:
Edit Post module for WordPress.
68 lines (64 loc) • 1.77 kB
JavaScript
import { createElement } from "@wordpress/element";
/**
* Defines as extensibility slot for the Status & visibility panel.
*/
/**
* WordPress dependencies
*/
import { createSlotFill, PanelRow } from '@wordpress/components';
export const {
Fill,
Slot
} = createSlotFill('PluginPostStatusInfo');
/**
* Renders a row in the Status & visibility panel of the Document sidebar.
* It should be noted that this is named and implemented around the function it serves
* and not its location, which may change in future iterations.
*
* @param {Object} props Component properties.
* @param {string} [props.className] An optional class name added to the row.
* @param {WPElement} props.children Children to be rendered.
*
* @example
* ```js
* // Using ES5 syntax
* var __ = wp.i18n.__;
* var PluginPostStatusInfo = wp.editPost.PluginPostStatusInfo;
*
* function MyPluginPostStatusInfo() {
* return wp.element.createElement(
* PluginPostStatusInfo,
* {
* className: 'my-plugin-post-status-info',
* },
* __( 'My post status info' )
* )
* }
* ```
*
* @example
* ```jsx
* // Using ESNext syntax
* import { __ } from '@wordpress/i18n';
* import { PluginPostStatusInfo } from '@wordpress/edit-post';
*
* const MyPluginPostStatusInfo = () => (
* <PluginPostStatusInfo
* className="my-plugin-post-status-info"
* >
* { __( 'My post status info' ) }
* </PluginPostStatusInfo>
* );
* ```
*
* @return {WPComponent} The component to be rendered.
*/
const PluginPostStatusInfo = ({
children,
className
}) => createElement(Fill, null, createElement(PanelRow, {
className: className
}, children));
PluginPostStatusInfo.Slot = Slot;
export default PluginPostStatusInfo;
//# sourceMappingURL=index.js.map