Skip to content

Commit

Permalink
Added doc for PostSlug components (WordPress#62102)
Browse files Browse the repository at this point in the history
  • Loading branch information
akasunil authored Jun 19, 2024
1 parent e056b9d commit a1623c0
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
17 changes: 15 additions & 2 deletions packages/editor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1268,11 +1268,24 @@ _Returns_

### PostSlug

Undocumented declaration.
Renders the PostSlug component. It provide a control for editing the post slug.

_Returns_

- `Component`: The component to be rendered.

### PostSlugCheck

Undocumented declaration.
Wrapper component that renders its children only if the post type supports the slug.

_Parameters_

- _props_ `Object`: Props.
- _props.children_ `Element`: Children to be rendered.

_Returns_

- `Component`: The component to be rendered.

### PostSticky

Expand Down
8 changes: 8 additions & 0 deletions packages/editor/src/components/post-slug/check.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
*/
import PostTypeSupportCheck from '../post-type-support-check';

/**
* Wrapper component that renders its children only if the post type supports the slug.
*
* @param {Object} props Props.
* @param {Element} props.children Children to be rendered.
*
* @return {Component} The component to be rendered.
*/
export default function PostSlugCheck( { children } ) {
return (
<PostTypeSupportCheck supportKeys="slug">
Expand Down
5 changes: 5 additions & 0 deletions packages/editor/src/components/post-slug/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ function PostSlugControl() {
);
}

/**
* Renders the PostSlug component. It provide a control for editing the post slug.
*
* @return {Component} The component to be rendered.
*/
export default function PostSlug() {
return (
<PostSlugCheck>
Expand Down

0 comments on commit a1623c0

Please sign in to comment.