Skip to content

Instantly share code, notes, and snippets.

@peterwilsoncc
Last active February 8, 2023 01:21
Show Gist options
  • Save peterwilsoncc/5525b365ffc8731a7ba8d630674f8d59 to your computer and use it in GitHub Desktop.
Save peterwilsoncc/5525b365ffc8731a7ba8d630674f8d59 to your computer and use it in GitHub Desktop.
Nux test plugin: Uses wp-scripts & register_block_type()
{
"apiVersion": 2,
"title": "Test Nux",
"name": "pwcc/test-nux",
"category": "layout",
"icon": "universal-access-alt",
"editorScript": "file:./index.js"
}
/**
* WordPress dependencies
*/
import { registerBlockType } from '@wordpress/blocks';
import { DotTip } from '@wordpress/nux';
import { select } from '@wordpress/data';
// Register the block
registerBlockType( 'pwcc/test-nux', {
edit: function () {
return (
<>
<p>
New user experience (NUX) is a term used to describe the process of guiding new users through the initial steps of using a product. The goal is to help them understand the product and how to use it.
<DotTip
tipId="my-tip-id"
position="bottom left"
>Demo for <a href="https://core.trac.wordpress.org/ticket/57643#comment:6">Trac#57643</a></DotTip>
</p>
</>
)
},
save: function () {
return <p> New user experience (NUX) is a term used to describe the process of guiding new users through the initial steps of using a product. The goal is to help them understand the product and how to use it. </p>;
},
} );
const isVisible = select( 'core/nux' ).isTipVisible( 'my-tip-id' );
console.log( "Tip isVisible", isVisible ); // true or false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment