diff --git a/Client/src/App.jsx b/Client/src/App.jsx index 16774c60a..367a66758 100644 --- a/Client/src/App.jsx +++ b/Client/src/App.jsx @@ -15,6 +15,7 @@ import ForgotPassword from "./Pages/ForgotPassword"; import CheckEmail from "./Pages/CheckEmail"; import SetNewPassword from "./Pages/SetNewPassword"; import NewPasswordConfirmed from "./Pages/NewPasswordConfirmed"; +import ToastComponent from "./Components/Toast"; function App() { return ( @@ -30,6 +31,7 @@ function App() { } /> } /> } /> + } /> } /> } /> } /> diff --git a/Client/src/Components/Toast/index.css b/Client/src/Components/Toast/index.css index 0653f3d27..c778d22f5 100644 --- a/Client/src/Components/Toast/index.css +++ b/Client/src/Components/Toast/index.css @@ -1,103 +1,3 @@ -.toast-container { - position: fixed; - bottom: 20px; /* Adjust as needed */ - right: 20px; /* Adjust as needed */ - z-index: 1000; /* Ensure it's above other content */ - } - - .toast { - background-color: #ffffff; - box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2); - border-radius: 8px; - padding: 16px; - min-width: 300px; /* Adjust minimum width as needed */ - max-width: 600px; /* Adjust maximum width as needed */ - position: relative; - animation: slideIn 0.3s ease forwards; - overflow: hidden; /* Ensure progress bar stays within bounds */ - display: flex; /* Use flexbox for layout */ - align-items: center; /* Center items vertically */ - } - - @keyframes slideIn { - 0% { - transform: translateY(-100%); - opacity: 0; - } - 100% { - transform: translateY(0%); - opacity: 1; - } - } - - .toast .info-icon-frame { - position: absolute; - top: 15px; /* Adjust top position as needed */ - left: 20px; /* Adjust left position as needed */ - } - - .icon { - position: absolute; - top: 15px; /* Adjust top position as needed */ - left: 20px; /* Adjust left position as needed */ - } - - .toast .toast-content { - flex-grow: 1; /* Allow content to expand */ - } - - .toast .announcement-content { - display: flex; - flex-direction: column; - margin-left: 10px; - } - - .toast .announcement-content-subject { - font-weight: bold; - margin-bottom: 8px; /* Space below subject */ - margin-left: 40px; /* Adjust left margin for more space */ - } - - .toast .announcement-content-body { - color: #555; - white-space: nowrap; /* Prevent text from wrapping */ - overflow: hidden; /* Hide any overflow */ - text-overflow: ellipsis; /* Show ellipsis (...) if the text overflows */ - margin-left: 40px; /* Adjust left margin for more space */ - } - - .toast .announcement-content-body-title { - display: inline-block; - margin-right: 5px; /* Adjust spacing between title and body */ - } - - .toast .announcement-content-controllers { - margin-top: 12px; - } - - .toast .controllers-button-esc, - .toast .controllers-button-primary { - cursor: pointer; - padding: 8px 16px; - margin-left: 23px; /* Adjust left margin for closer proximity */ - } - - - .toast-progress { - position: absolute; - bottom: 0; - left: 0; - height: 4px; - background-color: #29b6f6; /* Adjust color as needed */ - transition: width 0.1s linear; - } - - .close-button { - position: absolute; - top: 1px; - right: 10px; - cursor: pointer; - font-size: 35px; - color: #aaa; - } - \ No newline at end of file +.Toastify__toast-container { + width: auto; +} \ No newline at end of file diff --git a/Client/src/Components/Toast/index.jsx b/Client/src/Components/Toast/index.jsx index 37870a970..f3a06bdb1 100644 --- a/Client/src/Components/Toast/index.jsx +++ b/Client/src/Components/Toast/index.jsx @@ -1,63 +1,30 @@ -import { useState, useEffect } from "react"; import ComplexAlert from "../../Components/Icons/ComplexAlert/ComplexAlert"; -import "./index.css"; // Import your CSS file for toast styles +import AnnouncementsDualButtonWithIcon from "../../Components/Announcements/AnnouncementsDualButtonWithIcon/AnnouncementsDualButtonWithIcon"; +import "react-toastify/dist/ReactToastify.css"; +import { toast, ToastContainer } from "react-toastify"; +import "./index.css"; -const Toast = () => { - const [showToast, setShowToast] = useState(false); - const [progress, setProgress] = useState(100); // Start with full progress - - useEffect(() => { - let timer; - if (showToast) { - timer = setTimeout(() => { - setShowToast(false); - }, 5000); // 5000 milliseconds = 5 seconds - - // Interval to update progress bar - const interval = setInterval(() => { - setProgress((prevProgress) => prevProgress - (100 / 5000 * 100)); // Decrease progress based on time - }, 100); // Update every 100 milliseconds - - return () => { - clearTimeout(timer); - clearInterval(interval); - }; - } - }, [showToast]); - - const toggleToast = () => { - setShowToast(!showToast); - setProgress(100); // Reset progress when showing toast +const ToastComponent = () => { + const displayMsg = () => { + toast( + } + subject="There was a problem with that action" + body="Lorem ipsum dolor sit amet consectetur adipisicing elit. Aliquid pariatur, ipsum dolor." + esc="Dismiss" + primary="Learn more" + dismiss={() => toast.dismiss()} + />, + { closeButton: false } + ); }; return ( -
- - {showToast && ( -
- × -
- {} -
-
-
-
- There was a problem with that action -
-
- Lorem ipsum dolor sit amet consectetur adipisicing elit. Aliquid pariatur, ipsum dolor. -
-
-
Dismiss
-
View changes
-
-
-
-
-
- )} +
+ +
); }; -export default Toast; +export default ToastComponent;