diff options
author | Blaster4385 <blaster4385@tablaster.dev> | 2024-05-15 22:55:13 +0530 |
---|---|---|
committer | Blaster4385 <venkatesh@tablaster.dev> | 2024-06-09 14:10:27 +0530 |
commit | 731453588b93e02a113332d68f81e48bc11f7da7 (patch) | |
tree | 6b16d80ba200862ea71842b04de49298316551a2 /client/src/components/AlertToast/AlertToast.jsx | |
parent | 189ef9ef816d60fab71c0a12cdaaad245c988f37 (diff) |
feat: added keyboard accessibility
Diffstat (limited to 'client/src/components/AlertToast/AlertToast.jsx')
-rw-r--r-- | client/src/components/AlertToast/AlertToast.jsx | 24 |
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; |