import { motion, AnimatePresence } from 'framer-motion' import PixelartIcon, { pixelartIcons } from './PixelartIcon' import { useUsingTouch } from './utilsApp' const duration = 0.2 // save pass: login const toastHeight = 32 interface NotificationProps { open: boolean message: string type?: 'message' | 'error' | 'progress' subMessage?: string icon?: string action?: () => void topPosition?: number currentProgress?: number totalProgress?: number } export default ({ type = 'message', message, subMessage = '', open, icon = '', action = undefined as (() => void) | undefined, topPosition = 0, currentProgress, totalProgress, }: NotificationProps) => { const isUsingTouch = useUsingTouch() const isError = type === 'error' icon ||= isError ? 'alert' : 'message' const isLoader = type === 'progress' const top = (topPosition * toastHeight) + (isUsingTouch ? 18 : 0) // add space for mobile top buttons return {open && (
{translate(message)}
{translate(subMessage)}
{currentProgress !== undefined && totalProgress !== undefined && (
)}
)} }