content.js
1 year ago
filters.js
1 year ago
header.js
1 year ago
import-modal.js
1 year ago
list-item.js
1 year ago
notices.js
5 years ago
pagination.js
5 years ago
preview.js
1 year ago
publish-button.js
2 years ago
template-predefine.js
2 years ago
templates-content.js
1 year ago
tpc-templates-button.js
2 years ago
notices.js
39 lines
| 1 | /** |
| 2 | * WordPress dependencies |
| 3 | */ |
| 4 | import { Notice } from '@wordpress/components'; |
| 5 | import { useDispatch, useSelect } from '@wordpress/data'; |
| 6 | |
| 7 | const Notices = () => { |
| 8 | const notices = useSelect( ( select ) => |
| 9 | select( 'core/notices' ).getNotices( |
| 10 | 'themeisle-blocks/notices/templates-cloud' |
| 11 | ) |
| 12 | ); |
| 13 | |
| 14 | const { removeNotice } = useDispatch( 'core/notices' ); |
| 15 | |
| 16 | return ( |
| 17 | <div className="notices"> |
| 18 | { notices.map( ( notice ) => ( |
| 19 | <Notice |
| 20 | key={ notice.id } |
| 21 | status={ notice.status } |
| 22 | isDismissible={ notice.isDismissible } |
| 23 | onRemove={ () => |
| 24 | removeNotice( |
| 25 | notice.id, |
| 26 | 'themeisle-blocks/notices/templates-cloud' |
| 27 | ) |
| 28 | } |
| 29 | actions={ notice.actions } |
| 30 | > |
| 31 | { notice.content } |
| 32 | </Notice> |
| 33 | ) ) } |
| 34 | </div> |
| 35 | ); |
| 36 | }; |
| 37 | |
| 38 | export default Notices; |
| 39 |