Skip to content

Commit

Permalink
HeadingLevelDropdown: Remove unnecessary isPressed prop and curly braces
Browse files Browse the repository at this point in the history
  • Loading branch information
t-hamano committed Nov 29, 2023
1 parent 00ccb8b commit dd6cc3b
Showing 1 changed file with 16 additions and 25 deletions.
Expand Up @@ -46,31 +46,22 @@ export default function HeadingLevelDropdown( {
icon={ <HeadingLevelIcon level={ value } /> }
label={ __( 'Change level' ) }
controls={ options.map( ( targetLevel ) => {
{
const isActive = targetLevel === value;

return {
icon: (
<HeadingLevelIcon
level={ targetLevel }
isPressed={ isActive }
/>
),
title:
targetLevel === 0
? __( 'Paragraph' )
: sprintf(
// translators: %s: heading level e.g: "1", "2", "3"
__( 'Heading %d' ),
targetLevel
),
isActive,
onClick() {
onChange( targetLevel );
},
role: 'menuitemradio',
};
}
return {
icon: <HeadingLevelIcon level={ targetLevel } />,
title:
targetLevel === 0
? __( 'Paragraph' )
: sprintf(
// translators: %s: heading level e.g: "1", "2", "3"
__( 'Heading %d' ),
targetLevel
),
isActive: targetLevel === value,
onClick() {
onChange( targetLevel );
},
role: 'menuitemradio',
};
} ) }
/>
);
Expand Down

0 comments on commit dd6cc3b

Please sign in to comment.