UNPKG

@wordpress/edit-post

Version:
65 lines (59 loc) 1.62 kB
/** * 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. * * @example <caption>ES5</caption> * ```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 <caption>ESNext</caption> * ```jsx * // Using ESNext syntax * const { __ } = wp.i18n; * const { PluginPostStatusInfo } = wp.editPost; * * const MyPluginPostStatusInfo = () => ( * <PluginPostStatusInfo * className="my-plugin-post-status-info" * > * { __( 'My post status info' ) } * </PluginPostStatusInfo> * ); * ``` * * @return {WPElement} The WPElement to be rendered. */ const PluginPostStatusInfo = ( { children, className } ) => ( <Fill> <PanelRow className={ className }> { children } </PanelRow> </Fill> ); PluginPostStatusInfo.Slot = Slot; export default PluginPostStatusInfo;