NoticePanel.jsx
29 lines
| 1 | import { Button, PanelBody } from '@wordpress/components'; |
| 2 | import { closeSmall } from '@wordpress/icons'; |
| 3 | import { __ } from '@wordpress/i18n'; |
| 4 | |
| 5 | import './editor.scss'; |
| 6 | |
| 7 | export function NoticePanel( { children, title, onDismiss } ) { |
| 8 | return ( |
| 9 | <PanelBody |
| 10 | className="gb-notice-panel" |
| 11 | > |
| 12 | <div className="gb-notice-panel__header"> |
| 13 | <h2>{ title }</h2> |
| 14 | { !! onDismiss && ( |
| 15 | <Button |
| 16 | className="gb-notice-panel__dismiss" |
| 17 | onClick={ onDismiss } |
| 18 | icon={ closeSmall } |
| 19 | size="small" |
| 20 | label={ __( 'Dismiss', 'generateblocks' ) } |
| 21 | showTooltip |
| 22 | /> |
| 23 | ) } |
| 24 | </div> |
| 25 | { children } |
| 26 | </PanelBody> |
| 27 | ); |
| 28 | } |
| 29 |