diff --git a/packages/editor/README.md b/packages/editor/README.md index 7e81e4ec8d8107..673d3d100a956e 100644 --- a/packages/editor/README.md +++ b/packages/editor/README.md @@ -869,15 +869,32 @@ _Returns_ ### PostAuthor -Undocumented declaration. +Renders the component for selecting the post author. + +_Returns_ + +- `Component`: The component to be rendered. ### PostAuthorCheck -Undocumented declaration. +Wrapper component that renders its children only if the post type supports the author. + +_Parameters_ + +- _props_ `Object`: The component props. +- _props.children_ `Element`: Children to be rendered. + +_Returns_ + +- `Component|null`: The component to be rendered. Return `null` if the post type doesn't supports the author or if there are no authors available. ### PostAuthorPanel -Undocumented declaration. +Renders the Post Author Panel component. + +_Returns_ + +- `Component`: The component to be rendered. ### PostComments diff --git a/packages/editor/src/components/post-author/check.js b/packages/editor/src/components/post-author/check.js index ecda9e149b4ed8..d10a0a2ccf0bd0 100644 --- a/packages/editor/src/components/post-author/check.js +++ b/packages/editor/src/components/post-author/check.js @@ -11,6 +11,15 @@ import PostTypeSupportCheck from '../post-type-support-check'; import { store as editorStore } from '../../store'; import { AUTHORS_QUERY } from './constants'; +/** + * Wrapper component that renders its children only if the post type supports the author. + * + * @param {Object} props The component props. + * @param {Element} props.children Children to be rendered. + * + * @return {Component|null} The component to be rendered. Return `null` if the post type doesn't + * supports the author or if there are no authors available. + */ export default function PostAuthorCheck( { children } ) { const { hasAssignAuthorAction, hasAuthors } = useSelect( ( select ) => { const post = select( editorStore ).getCurrentPost(); diff --git a/packages/editor/src/components/post-author/index.js b/packages/editor/src/components/post-author/index.js index 7e734379f64f64..9ff3aaaf09a29c 100644 --- a/packages/editor/src/components/post-author/index.js +++ b/packages/editor/src/components/post-author/index.js @@ -13,6 +13,11 @@ import { AUTHORS_QUERY } from './constants'; const minimumUsersForCombobox = 25; +/** + * Renders the component for selecting the post author. + * + * @return {Component} The component to be rendered. + */ function PostAuthor() { const showCombobox = useSelect( ( select ) => { const authors = select( coreStore ).getUsers( AUTHORS_QUERY ); diff --git a/packages/editor/src/components/post-author/panel.js b/packages/editor/src/components/post-author/panel.js index 78f0e0a5f2cc89..ad2aa01dee3ab2 100644 --- a/packages/editor/src/components/post-author/panel.js +++ b/packages/editor/src/components/post-author/panel.js @@ -5,6 +5,11 @@ import PostAuthorCheck from './check'; import PostAuthorForm from './index'; import PostPanelRow from '../post-panel-row'; +/** + * Renders the Post Author Panel component. + * + * @return {Component} The component to be rendered. + */ export function PostAuthor() { return (