mirror of
https://github.com/pawelmalak/flame.git
synced 2025-07-20 20:19:35 +02:00
Components: refactored rest of the components to use new state. Minor changes to exports, imports and props
This commit is contained in:
parent
89d935e27f
commit
969bdb7d24
29 changed files with 462 additions and 733 deletions
|
@ -1,21 +1,20 @@
|
|||
import { connect } from 'react-redux';
|
||||
import { GlobalState, Notification as _Notification } from '../../interfaces';
|
||||
import { useSelector } from 'react-redux';
|
||||
import { Notification as NotificationInterface } from '../../interfaces';
|
||||
|
||||
import classes from './NotificationCenter.module.css';
|
||||
|
||||
import Notification from '../UI/Notification/Notification';
|
||||
import { Notification } from '../UI';
|
||||
import { State } from '../../store/reducers';
|
||||
|
||||
interface ComponentProps {
|
||||
notifications: _Notification[];
|
||||
}
|
||||
export const NotificationCenter = (): JSX.Element => {
|
||||
const { notifications } = useSelector((state: State) => state.notification);
|
||||
|
||||
const NotificationCenter = (props: ComponentProps): JSX.Element => {
|
||||
return (
|
||||
<div
|
||||
className={classes.NotificationCenter}
|
||||
style={{ height: `${props.notifications.length * 75}px` }}
|
||||
style={{ height: `${notifications.length * 75}px` }}
|
||||
>
|
||||
{props.notifications.map((notification: _Notification) => {
|
||||
{notifications.map((notification: NotificationInterface) => {
|
||||
return (
|
||||
<Notification
|
||||
title={notification.title}
|
||||
|
@ -29,11 +28,3 @@ const NotificationCenter = (props: ComponentProps): JSX.Element => {
|
|||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const mapStateToProps = (state: GlobalState) => {
|
||||
return {
|
||||
notifications: state.notification.notifications,
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps)(NotificationCenter);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue