From bec6ca3a86587e5f34097ed2077ebcebd2798b2c Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 4 Nov 2024 21:57:40 +0530 Subject: [PATCH 1/2] remember me --- client/src/component/Login.jsx | 19 ++++++++++++++++++- client/src/component/Signup.jsx | 18 ++++++++++++++++++ client/src/css/Login.css | 8 ++++++++ client/src/css/Signup.css | 8 ++++++++ 4 files changed, 52 insertions(+), 1 deletion(-) diff --git a/client/src/component/Login.jsx b/client/src/component/Login.jsx index a8dc484..fd81858 100644 --- a/client/src/component/Login.jsx +++ b/client/src/component/Login.jsx @@ -75,6 +75,20 @@ const Login = ({ mode, showAlert, isloggedin, setloggedin }) => { } } }; + document.querySelector('#login-btn').addEventListener('click', (event) => { + event.preventDefault(); + + const emailInput = document.getElementById('login-email'); + const rememberMeCheckbox = document.getElementById('login-remember'); + + if (rememberMeCheckbox.checked) { + localStorage.setItem('rememberedEmail', emailInput.value); + } else { + localStorage.removeItem('rememberedEmail'); + } + + // Continue with your existing login logic... + }); return (
@@ -139,7 +153,10 @@ const Login = ({ mode, showAlert, isloggedin, setloggedin }) => { />
- +
+ + +
diff --git a/client/src/component/Signup.jsx b/client/src/component/Signup.jsx index 63ce833..0aa28d2 100644 --- a/client/src/component/Signup.jsx +++ b/client/src/component/Signup.jsx @@ -76,6 +76,20 @@ const Signup = ({ mode }) => { }, body: JSON.stringify({ name, email, password }), }); + document.querySelector('#login-btn').addEventListener('click', (event) => { + event.preventDefault(); + + const emailInput = document.getElementById('login-email'); + const rememberMeCheckbox = document.getElementById('login-remember'); + + if (rememberMeCheckbox.checked) { + localStorage.setItem('rememberedEmail', emailInput.value); + } else { + localStorage.removeItem('rememberedEmail'); + } + + // Continue with your existing login logic... + }); const json = await response.json(); if (json.success) { @@ -238,6 +252,10 @@ const Signup = ({ mode }) => {
+
+ + +
); }; -export default ScrollTop; \ No newline at end of file +export default ScrollTop; diff --git a/client/src/css/ScrollTop.css b/client/src/css/ScrollTop.css index e595fae..7759e2b 100644 --- a/client/src/css/ScrollTop.css +++ b/client/src/css/ScrollTop.css @@ -2,7 +2,7 @@ display: none; position: fixed; bottom: 20px; - right: 80px; + right: 20px; z-index: 999; transition-duration: 0.3s; } @@ -11,54 +11,58 @@ display: block; } -.Scroll-Top .button { +.button { width: 50px; height: 50px; border-radius: 50%; - background-color: rgb(20, 20, 20); + background: linear-gradient(135deg, rgba(181, 160, 255, 1) 0%, rgba(20, 20, 20, 1) 100%); border: none; font-weight: 600; display: flex; align-items: center; justify-content: center; - box-shadow: 0px 0px 0px 4px rgba(180, 160, 255, 0.253); + box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2); cursor: pointer; - transition-duration: 0.3s; + position: relative; /* Necessary for the progress circle positioning */ overflow: hidden; + transition-duration: 0.3s; } -.Scroll-Top .svgIcon { +.svgIcon { width: 24px; transition-duration: 0.3s; } -.Scroll-Top .svgIcon path { +.svgIcon path { fill: white; } -.Scroll-Top .button:hover { - width: 140px; - border-radius: 50px; - transition-duration: 0.3s; - background-color: rgb(181, 160, 255); +.button:hover { + background: linear-gradient(135deg, rgba(255, 181, 160, 1) 0%, rgba(20, 20, 20, 1) 100%); } -.Scroll-Top .button:hover .svgIcon { - transition-duration: 0.3s; - transform: translateY(-200%); +/* Progress Circle */ +.progress-circle { + position: absolute; + top: 50%; + left: 50%; + width: 30px; /* Adjust size as needed */ + height: 30px; /* Adjust size as needed */ + border-radius: 50%; + border: 3px solid rgba(255, 255, 255, 0.7); + border-top-color: transparent; /* Make top part transparent for animation */ + animation: spin 1s linear infinite; /* Spin animation */ + transform: translate(-50%, -50%); /* Center it */ + opacity: 0; /* Initially hidden */ + transition: opacity 0.3s; /* Fade effect */ } -.Scroll-Top .button::before { - position: absolute; - bottom: -20px; - content: "Back to Top"; - color: white; - font-size: 0px; +.button:hover .progress-circle { + opacity: 1; /* Show on hover */ } -.Scroll-Top .button:hover::before { - font-size: 13px; - opacity: 1; - bottom: unset; - transition-duration: 0.3s; -} \ No newline at end of file +/* Animation for the progress circle */ +@keyframes spin { + 0% { transform: rotate(0deg); } + 100% { transform: rotate(360deg); } +}