import React from 'react'
import { toast } from 'react-toastify'
import styled from 'styled-components'
import { Icons } from '../icons'
const Icon = ({ type }) => (
type === "success"
?
: type === "error" || type === "warning"
?
:
);
const StyledDiv = styled.div`
margin-left: 15px;
`;
const ToastTitle = styled.p`
font-weight: bold;
margin: 0;
`;
const toastr = {
clear: clear,
error: error,
info: info,
success: success,
warning: warning
};
const notify = (type, text, title, autoClosed = true) => {
return toast(
<>
{title}
{text}
>,
{
type: type,
closeOnClick: autoClosed,
closeButton: !autoClosed,
autoClose: autoClosed
}
);
};
function success(text, title, autoClosed) {
return notify('success', text, title, autoClosed);
}
function error(text, title, autoClosed) {
return notify('error', text, title, autoClosed);
}
function warning(text, title, autoClosed) {
return notify('warning', text, title, autoClosed);
}
function info(text, title, autoClosed) {
return notify('info', text, title, autoClosed);
}
function clear() {
return toast.dismiss();
}
export default toastr;