Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |
import React from "react";
import { connect } from "react-redux";
import styled from "styled-components";
import AlertComponent from "./AlertComponent";
const NotificationDiv = styled.div`
position: fixed;
top: 1rem;
left: 50%;
transform: translateX(-50%);
/* width: 80vw; */
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
z-index: 1100;
`;
const NotificationAlert = (props) => {
// redux destructuring
const { notifications } = props;
return (
<NotificationDiv>
{notifications.map((notification) => {
return (
<AlertComponent notification={notification} key={notification.id} />
);
})}
</NotificationDiv>
);
};
const mapStateToProps = (state) => ({
notifications: state.notification.notifications,
});
// const mapDispatchToProps = {
// };
export default connect(mapStateToProps)(NotificationAlert);