import React from "react";
import { MdDangerous, MdDone, MdError, MdWarning } from "react-icons/md";
import {
Slide,
toast,
ToastContainer as ReactToastifyContainer,
TypeOptions,
} from "react-toastify";
const getIconAccordingToasterType = ({
type,
}: {
type: TypeOptions;
}): JSX.Element | null => {
switch (type) {
case toast.TYPE.INFO:
return ;
case toast.TYPE.ERROR:
return ;
case toast.TYPE.SUCCESS:
return ;
case toast.TYPE.WARNING:
return ;
default:
return null;
}
};
const ToastContainer: React.FunctionComponent = () => {
return (
);
};
export default ToastContainer;
function truncated(str: string): string {
const ellipsis = "...";
const maxLength = 28;
if (str.length <= maxLength) return str;
return str.slice(0, maxLength) + ellipsis;
}
export const ToastMessageWithPath: React.FC<{
message: string;
path: string;
}> = ({ message, path }) => {
const maybeTruncatedPath = truncated(path);
return (
{message}
{maybeTruncatedPath}
);
};
export const SliceToastMessage: React.FC<{
path: string;
}> = (props) => (
);