| 1 |
import {useSelect} from '@wordpress/data'; |
| 2 |
import Notification from './Notification'; |
| 3 |
import styles from './Notices.module.scss'; |
| 4 |
|
| 5 |
export default ({type}: {type: 'snackbar' | 'notice'}) => { |
| 6 |
//@ts-ignore |
| 7 |
const notifications = useSelect(select => select('givewp/campaign-notifications').getNotificationsByType(type)); |
| 8 |
|
| 9 |
if (!notifications.length) { |
| 10 |
return null; |
| 11 |
} |
| 12 |
|
| 13 |
return ( |
| 14 |
<div className={styles[`${type}Container`]}> |
| 15 |
{notifications.map(notification => <Notification notification={notification} />)} |
| 16 |
</div> |
| 17 |
); |
| 18 |
} |
| 19 |
|