2020-10-26 18:26:48 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import { __ } from '@wordpress/i18n';
|
|
|
|
import { Button } from '@wordpress/components';
|
2021-09-15 16:42:54 +00:00
|
|
|
import { registerPlugin } from '@wordpress/plugins';
|
|
|
|
import { WooNavigationItem } from '@woocommerce/navigation';
|
2020-10-26 18:26:48 +00:00
|
|
|
|
|
|
|
const MyPlugin = () => {
|
2021-09-15 16:42:54 +00:00
|
|
|
const handleClick = () => {
|
|
|
|
alert( 'Menu item clicked!' );
|
|
|
|
};
|
2020-10-26 18:26:48 +00:00
|
|
|
|
2021-09-15 16:42:54 +00:00
|
|
|
return (
|
|
|
|
<WooNavigationItem item="example-category-child-2">
|
|
|
|
<Button onClick={ handleClick }>
|
|
|
|
{ __( 'JavaScript Example', 'plugin-domain' ) }
|
|
|
|
</Button>
|
|
|
|
</WooNavigationItem>
|
|
|
|
);
|
2020-10-26 18:26:48 +00:00
|
|
|
};
|
|
|
|
|
2021-09-15 16:42:54 +00:00
|
|
|
registerPlugin( 'my-plugin', {
|
|
|
|
render: MyPlugin,
|
|
|
|
scope: 'woocommerce-navigation',
|
|
|
|
} );
|