aboutsummaryrefslogtreecommitdiff
path: root/pages/lib/useNotify.js
diff options
context:
space:
mode:
authorFactiven <[email protected]>2023-04-14 00:14:12 +0700
committerFactiven <[email protected]>2023-04-14 00:14:12 +0700
commit70fda74d27d9b55c9030932794daa25c1e6cf50d (patch)
tree0c1f639be4e8ec1b960ba642b8e99c1485e83b1a /pages/lib/useNotify.js
parentUpdate 5th (diff)
downloadmoopa-70fda74d27d9b55c9030932794daa25c1e6cf50d.tar.xz
moopa-70fda74d27d9b55c9030932794daa25c1e6cf50d.zip
Update 6th
Diffstat (limited to 'pages/lib/useNotify.js')
-rw-r--r--pages/lib/useNotify.js41
1 files changed, 0 insertions, 41 deletions
diff --git a/pages/lib/useNotify.js b/pages/lib/useNotify.js
deleted file mode 100644
index e6ba7e6..0000000
--- a/pages/lib/useNotify.js
+++ /dev/null
@@ -1,41 +0,0 @@
-import { useState, useCallback } from "react";
-import { motion as m, AnimatePresence } from "framer-motion";
-
-export const useNotification = () => {
- const [showNotification, setShowNotification] = useState(false);
- const [notificationMessage, setNotificationMessage] = useState("");
-
- const show = useCallback(
- (message) => {
- setNotificationMessage(message);
- setShowNotification(true);
- setTimeout(() => {
- setShowNotification(false);
- }, 5000);
- },
- [setNotificationMessage, setShowNotification]
- );
-
- const NotificationComponent = () => {
- return (
- <AnimatePresence>
- {showNotification && (
- <m.div
- key="teasa"
- transition={{ duration: 0.5 }}
- initial={{ opacity: 0, y: 100 }}
- animate={{ opacity: 1, y: 0 }}
- exit={{ opacity: 0, y: 100 }}
- className="z-50 fixed bottom-10 w-screen flex justify-center text-center"
- >
- <div className="bg-green-600 text-white px-2 py-2 font-bold rounded-[30px]">
- {notificationMessage}
- </div>
- </m.div>
- )}
- </AnimatePresence>
- );
- };
-
- return { Notification: NotificationComponent, show };
-};