1
0
Fork 0
mirror of https://github.com/pawelmalak/flame.git synced 2025-07-21 04:19:37 +02:00
flame/client/src/components/NotificationCenter/NotificationCenter.tsx

38 lines
992 B
TypeScript
Raw Normal View History

import { connect } from 'react-redux';
import { GlobalState, Notification as _Notification } from '../../interfaces';
import classes from './NotificationCenter.module.css';
import Notification from '../UI/Notification/Notification';
interface ComponentProps {
notifications: _Notification[];
}
const NotificationCenter = (props: ComponentProps): JSX.Element => {
return (
<div
className={classes.NotificationCenter}
style={{ height: `${props.notifications.length * 75}px` }}
>
{props.notifications.map((notification: _Notification) => {
return (
<Notification
title={notification.title}
message={notification.message}
id={notification.id}
key={notification.id}
/>
)
})}
</div>
)
}
const mapStateToProps = (state: GlobalState) => {
return {
notifications: state.notification.notifications
}
}
export default connect(mapStateToProps)(NotificationCenter);