2021-11-09 14:33:51 +01:00
|
|
|
import { useSelector } from 'react-redux';
|
|
|
|
import { Notification as NotificationInterface } from '../../interfaces';
|
2021-05-24 14:54:46 +02:00
|
|
|
|
|
|
|
import classes from './NotificationCenter.module.css';
|
|
|
|
|
2021-11-09 14:33:51 +01:00
|
|
|
import { Notification } from '../UI';
|
|
|
|
import { State } from '../../store/reducers';
|
2021-05-24 14:54:46 +02:00
|
|
|
|
2021-11-09 14:33:51 +01:00
|
|
|
export const NotificationCenter = (): JSX.Element => {
|
|
|
|
const { notifications } = useSelector((state: State) => state.notification);
|
2021-05-24 14:54:46 +02:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div
|
|
|
|
className={classes.NotificationCenter}
|
2021-11-09 14:33:51 +01:00
|
|
|
style={{ height: `${notifications.length * 75}px` }}
|
2021-05-24 14:54:46 +02:00
|
|
|
>
|
2021-11-09 14:33:51 +01:00
|
|
|
{notifications.map((notification: NotificationInterface) => {
|
2021-05-24 14:54:46 +02:00
|
|
|
return (
|
|
|
|
<Notification
|
|
|
|
title={notification.title}
|
|
|
|
message={notification.message}
|
2021-10-05 16:31:56 +02:00
|
|
|
url={notification.url || null}
|
2021-05-24 14:54:46 +02:00
|
|
|
id={notification.id}
|
|
|
|
key={notification.id}
|
|
|
|
/>
|
2021-10-05 16:31:56 +02:00
|
|
|
);
|
2021-05-24 14:54:46 +02:00
|
|
|
})}
|
|
|
|
</div>
|
2021-10-05 16:31:56 +02:00
|
|
|
);
|
|
|
|
};
|