UNPKG

@wordpress/editor

Version:
40 lines (36 loc) 1.08 kB
import { createElement } from "@wordpress/element"; /** * WordPress dependencies */ import { __ } from '@wordpress/i18n'; import { CheckboxControl } from '@wordpress/components'; import { withSelect, withDispatch } from '@wordpress/data'; import { compose } from '@wordpress/compose'; /** * Internal dependencies */ import PostPendingStatusCheck from './check'; export function PostPendingStatus({ status, onUpdateStatus }) { const togglePendingStatus = () => { const updatedStatus = status === 'pending' ? 'draft' : 'pending'; onUpdateStatus(updatedStatus); }; return createElement(PostPendingStatusCheck, null, createElement(CheckboxControl, { label: __('Pending review'), checked: status === 'pending', onChange: togglePendingStatus })); } export default compose(withSelect(select => ({ status: select('core/editor').getEditedPostAttribute('status') })), withDispatch(dispatch => ({ onUpdateStatus(status) { dispatch('core/editor').editPost({ status }); } })))(PostPendingStatus); //# sourceMappingURL=index.js.map