diff --git a/src/components/notification/notification.tsx b/src/components/notification/notification.tsx new file mode 100644 index 00000000..c47a9b7c --- /dev/null +++ b/src/components/notification/notification.tsx @@ -0,0 +1,98 @@ +import { Fragment, useState, useEffect } from 'react'; +import { motion } from 'framer-motion'; +import { Transition } from '@headlessui/react'; +import { BiSolidErrorAlt, BiCheck, BiInfoCircle } from 'react-icons/bi'; +import { XMarkIcon } from '@heroicons/react/20/solid' +import { toastAnimationAppear } from '../../utils/animation/toastAnimation'; +export default function Notification({ onDismiss, timer, type, message }) { + const [show, setShow] = useState(true); + useEffect(() => { + const timeout = setTimeout(() => { + dismissToast(); + }, timer); + + return () => clearTimeout(timeout); + }, [timer]); + + const dismissToast = () => { + setShow(false); + setTimeout(() => { + onDismiss(); + }, 300); + }; + + const getIcon = () => { + switch (type) { + case 'error': + return