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

HeadingLevelDropdown: Fix JSDoc and documentation #59727

Merged
merged 1 commit into from Mar 9, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -28,23 +28,23 @@ const MyHeadingLevelToolbar = () => (

#### options

The list of available HTML tags, passed from the block.
The list of available heading levels, passed from the block.

- Type: `Object`
- Required: no

#### value

The chosen HTML tag.
The chosen heading level.

- Type: `string`
- Type: `number`
- Required: no

#### onChange

Callback to run when toolbar value is changed.
Function called with the selected value changes.

- Type: `string`
- Type: `() => number`
- Required: yes

## Related components
Expand Down
Expand Up @@ -22,10 +22,10 @@ const POPOVER_PROPS = {
*
* @typedef WPHeadingLevelDropdownProps
*
* @property {number} value The chosen heading level.
* @property {number[]} options An array of supported heading levels.
* @property {(newValue:number)=>any} onChange Callback to run when
* toolbar value is changed.
* @property {number} value The chosen heading level.
* @property {number[]} options An array of supported heading levels.
* @property {()=>number} onChange Function called with
* the selected value changes.
*/

/**
Expand Down Expand Up @@ -53,7 +53,7 @@ export default function HeadingLevelDropdown( {
targetLevel === 0
? __( 'Paragraph' )
: sprintf(
// translators: %s: heading level e.g: "1", "2", "3"
// translators: %d: heading level e.g: "1", "2", "3"
__( 'Heading %d' ),
targetLevel
),
Expand Down
Expand Up @@ -18,9 +18,10 @@ const HEADING_LEVELS = [ 1, 2, 3, 4, 5, 6 ];
*
* @typedef WPHeadingLevelDropdownProps
*
* @property {number} selectedLevel The chosen heading level.
* @property {(newValue:number)=>any} onChange Callback to run when
* toolbar value is changed.
* @property {number} value The chosen heading level.
* @property {number[]} options An array of supported heading levels.
* @property {()=>number} onChange Function called with
* the selected value changes.
*/

/**
Expand Down Expand Up @@ -48,7 +49,7 @@ export default function HeadingLevelDropdown( {
isPressed={ isActive }
/>
),
// translators: %s: heading level e.g: "1", "2", "3"
// translators: %d: heading level e.g: "1", "2", "3"
title: sprintf( __( 'Heading %d' ), targetLevel ),
isActive,
onClick: () => onChangeCallback( targetLevel ),
Expand Down