import TrashButton from "../../../Components/Ui/TrashButton"
import { notifications } from "../../../types/Notifications"


const Card = ({name,date,image,id,pop,setPop}:notifications) => {
    const handleDeleteOne = () => {
        setPop(pop?.filter((item:any)=> item?.id !== id))
    }
    
  return (
        <div className="notification_card" key={id}>
            <div>
                <img src={image} alt={name} />
                <div>
                    <h5>{name}</h5>
                    <p>{date}</p>
                </div>
            </div>
            <div>
                <TrashButton 
                 onClick={handleDeleteOne} 
                 name="delete"
                 icon={false}/>
            </div>
        </div>  
    )
}

export default Card