Skip to content

Commit

Permalink
HeadingLevelDropdown: Fix JSDoc and documentation (#59727)
Browse files Browse the repository at this point in the history
Co-authored-by: t-hamano <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
  • Loading branch information
3 people authored Mar 9, 2024
1 parent 4d9a27e commit d181fe8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

0 comments on commit d181fe8

Please sign in to comment.