Created
February 7, 2019 18:31
-
-
Save jeremyfelt/98cabf0a8cde75b2a3e1b4783e651702 to your computer and use it in GitHub Desktop.
Creating a notice in Gutenberg
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
// See https://github.com/WordPress/gutenberg/blob/master/docs/designers-developers/developers/tutorials/notices/README.md | |
const { | |
dispatch, | |
} = wp.data; | |
const { | |
createWarningNotice, | |
} = dispatch( 'core/notices' ); | |
createWarningNotice( | |
'Warning message', | |
{ | |
isDismissible: false, | |
id: 'warningmessage', | |
actions: [ | |
{ | |
url: 'https://google.com', | |
label: 'This is a URL', | |
}, | |
{ | |
label: 'This is a button', | |
onClick: ( s ) => { console.log( s, 'this' ); }, | |
className: 'custom_classname', | |
}, | |
], | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment