-
-
Save peterwilsoncc/5525b365ffc8731a7ba8d630674f8d59 to your computer and use it in GitHub Desktop.
Nux test plugin: Uses wp-scripts & register_block_type()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"apiVersion": 2, | |
"title": "Test Nux", | |
"name": "pwcc/test-nux", | |
"category": "layout", | |
"icon": "universal-access-alt", | |
"editorScript": "file:./index.js" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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