From 62a3826876e6c37002882c1b5712b3771f805907 Mon Sep 17 00:00:00 2001 From: Factiven Date: Sun, 18 Jun 2023 00:56:47 +0700 Subject: Performance update --- lib/useNotify.js | 41 ----------------------------------------- 1 file changed, 41 deletions(-) delete mode 100644 lib/useNotify.js (limited to 'lib/useNotify.js') diff --git a/lib/useNotify.js b/lib/useNotify.js deleted file mode 100644 index e6ba7e6..0000000 --- a/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 ( - - {showNotification && ( - -
- {notificationMessage} -
-
- )} -
- ); - }; - - return { Notification: NotificationComponent, show }; -}; -- cgit v1.2.3