Skip to content

Commit

Permalink
Editor: Use plugin context hook in 'PluginMoreMenuItem' (#66351)
Browse files Browse the repository at this point in the history
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: youknowriad <youknowriad@git.wordpress.org>
  • Loading branch information
3 people authored Oct 23, 2024
1 parent 9421bc9 commit f57081e
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions packages/editor/src/components/plugin-more-menu-item/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
/**
* WordPress dependencies
*/
import { compose } from '@wordpress/compose';
import { MenuItem } from '@wordpress/components';
import { withPluginContext } from '@wordpress/plugins';
import { usePluginContext } from '@wordpress/plugins';
import { ActionItem } from '@wordpress/interface';

/**
Expand Down Expand Up @@ -62,12 +61,14 @@ import { ActionItem } from '@wordpress/interface';
*
* @return {Component} The component to be rendered.
*/
export default compose(
withPluginContext( ( context, ownProps ) => {
return {
as: ownProps.as ?? MenuItem,
icon: ownProps.icon || context.icon,
name: 'core/plugin-more-menu',
};
} )
)( ActionItem );
export default function PluginMoreMenuItem( props ) {
const context = usePluginContext();
return (
<ActionItem
name="core/plugin-more-menu"
as={ props.as ?? MenuItem }
icon={ props.icon || context.icon }
{ ...props }
/>
);
}

0 comments on commit f57081e

Please sign in to comment.