import React, { useState } from "react" import PropTypes from "prop-types" import { connect } from "react-redux" import { Toast } from "react-bootstrap" import { removeNotification } from "../../actions/notifications" const NotificationConnected = ({ id, icon, title, message, imageUrl, autohide, delay, removeNotification, }) => { const [show, setShow] = useState(true) const hide = () => { setShow(false); setTimeout(() => removeNotification(id), 200); } return ( {icon !== "" && } {title} {message !== "" && {message} } {imageUrl !== "" && } ) } NotificationConnected.propTypes = { id: PropTypes.string, icon: PropTypes.string, title: PropTypes.string, message: PropTypes.string, imageUrl: PropTypes.string, autohide: PropTypes.bool, delay: PropTypes.number, removeNotification: PropTypes.func, }; NotificationConnected.defaultProps = { autohide: false, delay: 5000, icon: "", imageUrl: "", title: "Info", message: "", }; export const Notification = connect(null, {removeNotification})(NotificationConnected);