Created
February 4, 2020 08:55
-
-
Save p-jackson/fe601434d0ab5202387f9799ebae184e to your computer and use it in GitHub Desktop.
Testing block with notice in placeholder
This file contains hidden or 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 { Placeholder, withNotices } from '@wordpress/components'; | |
import { useEffect } from '@wordpress/element'; | |
import { __ } from '@wordpress/i18n'; | |
import { resizeCornerNE as icon } from '@wordpress/icons'; | |
const Edit = withNotices( ( { noticeOperations, noticeUI } ) => { | |
useEffect( () => { | |
noticeOperations.createErrorNotice( "I'm surrounded by errors!" ); | |
}, [] ); | |
return ( | |
<Placeholder notices={ noticeUI }> | |
<p>nothing to see here</p> | |
</Placeholder> | |
); | |
} ); | |
export const name = 'core/testing'; | |
export const metadata = { category: 'layout' }; | |
export const settings = { | |
title: __( 'Testing' ), | |
description: __( 'just does testing' ), | |
icon, | |
edit() { | |
return <Edit />; | |
}, | |
save() { | |
return <p />; | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment