aboutsummaryrefslogtreecommitdiff
path: root/client/src/components/AlertToast/AlertToast.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/components/AlertToast/AlertToast.jsx')
-rw-r--r--client/src/components/AlertToast/AlertToast.jsx24
1 files changed, 24 insertions, 0 deletions
diff --git a/client/src/components/AlertToast/AlertToast.jsx b/client/src/components/AlertToast/AlertToast.jsx
new file mode 100644
index 0000000..824b9e6
--- /dev/null
+++ b/client/src/components/AlertToast/AlertToast.jsx
@@ -0,0 +1,24 @@
+import React, { useEffect } from "react";
+import styles from "./AlertToast.module.css";
+
+const AlertToast = ({ openAlertToast, setOpenAlertToast }) => {
+ useEffect(() => {
+ const timer = setTimeout(() => {
+ setOpenAlertToast(false);
+ }, 3000);
+
+ return () => clearTimeout(timer);
+ }, [openAlertToast, setOpenAlertToast]);
+
+ return (
+ <div
+ className={`${styles.background} ${openAlertToast ? styles.active : ""}`}
+ >
+ <div className={styles.container}>
+ <p className={styles.container__title}>Please enter some text!</p>
+ </div>
+ </div>
+ );
+};
+
+export default AlertToast;