PluginProbe
TablePress – Tables in WordPress made easy / 3.3
TablePress – Tables in WordPress made easy v3.3
3.3.4 3.3.3 3.3.2 3.3.1 trunk 1.12 1.14 1.9.2 2.0.4 2.1.7 2.1.8 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.3 2.3.1 2.3.2 2.4 2.4.1 2.4.2 2.4.3 2.4.4 All 44 releases
tablepress / admin / js / common / notifications.jsx

notifications.jsx in TablePress – Tables in WordPress made easy 3.3, at admin/js/common/notifications.jsx

38 lines 831 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * JavaScript code for the "Edit" section integration of Snackbar Notices.
3 *
4 * @package TablePress
5 * @subpackage Views JavaScript
6 * @author Tobias Bäthge
7 * @since 3.1.0
8 */
9
10 /**
11 * WordPress dependencies.
12 */
13 import { SnackbarList } from '@wordpress/components';
14 import { useDispatch, useSelect } from '@wordpress/data';
15 import { store as noticesStore } from '@wordpress/notices';
16
17 const Notifications = () => {
18 const { removeNotice } = useDispatch( noticesStore );
19 const notices = useSelect(
20 ( select ) => select( noticesStore ).getNotices(),
21 []
22 );
23 const snackbarNotices = notices.filter( ( { type } ) => type === 'snackbar' );
24
25 if ( snackbarNotices.length === 0 ) {
26 return null;
27 }
28
29 return (
30 <SnackbarList
31 notices={ snackbarNotices }
32 onRemove={ removeNotice }
33 />
34 );
35 };
36
37 export { Notifications };
38