Skip to content

Commit

Permalink
Components: Use isPressed prop instead of the hard-coded `is-presse…
Browse files Browse the repository at this point in the history
…d` class
  • Loading branch information
t-hamano committed Oct 3, 2023
1 parent 140d04e commit 9719b78
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
/**
* External dependencies
*/
import classnames from 'classnames';

/**
* WordPress dependencies
*/
Expand Down Expand Up @@ -48,10 +43,8 @@ const FormatToolbar = () => {
label={ __( 'More' ) }
toggleProps={ {
...toggleProps,
className: classnames(
toggleProps.className,
{ 'is-pressed': hasActive }
),
className: toggleProps.className,
isPressed: hasActive,
describedBy: __(
'Displays more block tools'
),
Expand Down
6 changes: 2 additions & 4 deletions packages/block-library/src/search/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ export default function SearchEdit( {
showLabel: ! showLabel,
} );
} }
className={ showLabel ? 'is-pressed' : undefined }
isPressed={ showLabel }
/>
<ToolbarDropdownMenu
icon={ getButtonPositionIcon() }
Expand All @@ -395,9 +395,7 @@ export default function SearchEdit( {
buttonUseIcon: ! buttonUseIcon,
} );
} }
className={
buttonUseIcon ? 'is-pressed' : undefined
}
isPressed={ buttonUseIcon }
/>
) }
</ToolbarGroup>
Expand Down

0 comments on commit 9719b78

Please sign in to comment.