diff --git a/packages/editor/README.md b/packages/editor/README.md index 3e21fc035ab5c..bf417d88c6b2a 100644 --- a/packages/editor/README.md +++ b/packages/editor/README.md @@ -1113,11 +1113,24 @@ _Returns_ ### PostPendingStatus -Undocumented declaration. +A component for displaying and toggling the pending status of a post. + +_Returns_ + +- `JSX.Element`: The rendered component. ### PostPendingStatusCheck -Undocumented declaration. +This component checks the publishing status of the current post. If the post is already published or the user doesn't have the capability to publish, it returns null. + +_Parameters_ + +- _props_ `Object`: Component properties. +- _props.children_ `Element`: Children to be rendered. + +_Returns_ + +- `JSX.Element|null`: The rendered child elements or null if the post is already published or the user doesn't have the capability to publish. ### PostPingbacks diff --git a/packages/editor/src/components/post-pending-status/check.js b/packages/editor/src/components/post-pending-status/check.js index 347cb6d727227..7a4ff5195041c 100644 --- a/packages/editor/src/components/post-pending-status/check.js +++ b/packages/editor/src/components/post-pending-status/check.js @@ -8,6 +8,16 @@ import { useSelect } from '@wordpress/data'; */ import { store as editorStore } from '../../store'; +/** + * This component checks the publishing status of the current post. + * If the post is already published or the user doesn't have the + * capability to publish, it returns null. + * + * @param {Object} props Component properties. + * @param {Element} props.children Children to be rendered. + * + * @return {JSX.Element|null} The rendered child elements or null if the post is already published or the user doesn't have the capability to publish. + */ export function PostPendingStatusCheck( { children } ) { const { hasPublishAction, isPublished } = useSelect( ( select ) => { const { isCurrentPostPublished, getCurrentPost } = diff --git a/packages/editor/src/components/post-pending-status/index.js b/packages/editor/src/components/post-pending-status/index.js index 85557517da6a1..8363ebc715891 100644 --- a/packages/editor/src/components/post-pending-status/index.js +++ b/packages/editor/src/components/post-pending-status/index.js @@ -11,6 +11,11 @@ import { useDispatch, useSelect } from '@wordpress/data'; import PostPendingStatusCheck from './check'; import { store as editorStore } from '../../store'; +/** + * A component for displaying and toggling the pending status of a post. + * + * @return {JSX.Element} The rendered component. + */ export function PostPendingStatus() { const status = useSelect( ( select ) => select( editorStore ).getEditedPostAttribute( 'status' ),