Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation for PostSlug and PostSlugCheck component #62102

Merged
merged 5 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading