import React from 'react' import { Box } from 'theme-ui' import type { ReactNode, FC } from 'react' import { CrossIcon } from './CrossIcon' import { ErrorIcon } from './ErrorIcon' import { WarningIcon } from './WarningIcon' import { CheckIcon } from './CheckIcon' type ToastType = 'warning' | 'error' | 'success' const typeIcons: Record = { error: ErrorIcon, warning: WarningIcon, success: CheckIcon, } interface Props { content: ReactNode hideToast: () => void type?: ToastType } const Toast: FC = ({ content, hideToast, type = 'success' }) => { if (!content) { return null } const Icon = typeIcons[type] return ( {content} ) } export default Toast