Skip to content

Commit

Permalink
Refine PostVisibitly editor component JSDocs
Browse files Browse the repository at this point in the history
  • Loading branch information
colorful-tones committed May 17, 2024
1 parent 1f4ecb5 commit 097537e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 22 deletions.
8 changes: 3 additions & 5 deletions packages/editor/src/components/post-visibility/check.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@ import { useSelect } from '@wordpress/data';
import { store as editorStore } from '../../store';

/**
* PostVisibilityCheck component.
*
* Determines if the current post can be edited (published)
* and passes this information to the provided render function.
*
* @param {Object} props - Component properties.
* @param {Function} props.render - Function to render the component.
* @param {Object} props The component props.
* @param {Function} props.render Function to render the component.
* Receives an object with a `canEdit` property.
* @return {JSX.Element} Rendered component.
* @return {JSX.Element} The rendered component.
*/
export default function PostVisibilityCheck( { render } ) {
const canEdit = useSelect( ( select ) => {
Expand Down
16 changes: 1 addition & 15 deletions packages/editor/src/components/post-visibility/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@ import { visibilityOptions } from './utils';
import { store as editorStore } from '../../store';

/**
* PostVisibility component.
*
* Allows users to set the visibility of a post.
*
* @param {Object} props Component properties.
* @param {Object} props The component props.
* @param {Function} props.onClose Function to call when the popover is closed.
* @return {JSX.Element} The rendered component.
*/
Expand Down Expand Up @@ -142,18 +140,6 @@ export default function PostVisibility( { onClose } ) {
);
}

/**
* PostVisibilityChoice component.
*
* Renders a visibility choice option.
*
* @param {Object} props - Component properties.
* @param {number} props.instanceId - Unique instance ID for the component.
* @param {string} props.value - The value of the visibility option.
* @param {string} props.label - The label for the visibility option.
* @param {string} props.info - Additional information about the visibility option.
* @return {JSX.Element} The rendered component.
*/
function PostVisibilityChoice( { instanceId, value, label, info, ...props } ) {
return (
<div className="editor-post-visibility__choice">
Expand Down
2 changes: 0 additions & 2 deletions packages/editor/src/components/post-visibility/label.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import { visibilityOptions } from './utils';
import { store as editorStore } from '../../store';

/**
* PostVisibilityLabel component.
*
* Returns the label for the current post visibility setting.
*
* @return {string} Post visibility label.
Expand Down

0 comments on commit 097537e

Please sign in to comment.