UNPKG

@wordpress/editor

Version:
49 lines (46 loc) 1.48 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.PostPendingStatus = PostPendingStatus; exports.default = void 0; var _i18n = require("@wordpress/i18n"); var _components = require("@wordpress/components"); var _data = require("@wordpress/data"); var _check = _interopRequireDefault(require("./check")); var _store = require("../../store"); var _jsxRuntime = require("react/jsx-runtime"); /** * WordPress dependencies */ /** * Internal dependencies */ /** * A component for displaying and toggling the pending status of a post. * * @return {JSX.Element} The rendered component. */ function PostPendingStatus() { const status = (0, _data.useSelect)(select => select(_store.store).getEditedPostAttribute('status'), []); const { editPost } = (0, _data.useDispatch)(_store.store); const togglePendingStatus = () => { const updatedStatus = status === 'pending' ? 'draft' : 'pending'; editPost({ status: updatedStatus }); }; return /*#__PURE__*/(0, _jsxRuntime.jsx)(_check.default, { children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.CheckboxControl, { __nextHasNoMarginBottom: true, label: (0, _i18n.__)('Pending review'), checked: status === 'pending', onChange: togglePendingStatus }) }); } var _default = exports.default = PostPendingStatus; //# sourceMappingURL=index.js.map