From b27f29bb52a78e89f6c92b8cea0d2b3a5fed772f Mon Sep 17 00:00:00 2001 From: Shubham-Lal Date: Mon, 17 Jun 2024 11:04:59 +0530 Subject: [PATCH] client: update card styling, add forgot tab --- client/src/components/card/claim-username.css | 12 ++-- client/src/components/card/claim-username.tsx | 6 +- .../components/modal/auth/forgot-password.tsx | 55 +++++++++++++++++++ client/src/components/modal/auth/index.css | 24 +++++++- client/src/components/modal/auth/index.tsx | 5 +- .../src/components/modal/auth/login-tab.tsx | 5 +- .../src/components/modal/auth/signup-tab.tsx | 4 +- client/src/globals.css | 4 +- client/src/store/useAuthStore.ts | 3 +- 9 files changed, 103 insertions(+), 15 deletions(-) create mode 100644 client/src/components/modal/auth/forgot-password.tsx diff --git a/client/src/components/card/claim-username.css b/client/src/components/card/claim-username.css index b886ce2..18f0deb 100644 --- a/client/src/components/card/claim-username.css +++ b/client/src/components/card/claim-username.css @@ -1,10 +1,10 @@ :root { - --claim-border: #000; - --username-bg: #E8E8E8; + --claim-border: #E5E4E2; + --username-bg: #E5E4E2; --username-color: #000; --username-input-bg: #FFF; --username-input-color: #000; - --submit-bg: #1F1F21; + --submit-bg: #FFF; } [data-theme='dark'] { @@ -99,7 +99,11 @@ } #claim-username .submit-btn span { - color: #FFFFFF; + color: var(--username-color); +} + +#claim-username .submit-btn svg { + color: var(--username-color); } @media screen and (max-width: 1024px) { diff --git a/client/src/components/card/claim-username.tsx b/client/src/components/card/claim-username.tsx index 58e477d..4c1c4d2 100644 --- a/client/src/components/card/claim-username.tsx +++ b/client/src/components/card/claim-username.tsx @@ -72,15 +72,15 @@ const ClaimUsername = () => { onChange={handleUsernameChange} onKeyPress={handleKeyPress} className={isSubmitted && (!username || message.type === 'error') ? "shake" : ""} - style={{ border: isSubmitted && (!username || message.type === 'error') ? "2px dotted white" : "" }} + style={{ border: isSubmitted && (!username || message.type === 'error') ? "2px dotted var(--username-color)" : "" }} /> {message.content &&

{message.content}

} diff --git a/client/src/components/modal/auth/forgot-password.tsx b/client/src/components/modal/auth/forgot-password.tsx new file mode 100644 index 0000000..b62088d --- /dev/null +++ b/client/src/components/modal/auth/forgot-password.tsx @@ -0,0 +1,55 @@ +import { useState } from "react" +import { useAuthStore, AuthTab } from "../../../store/useAuthStore" +// import { LoadingSVG } from "../../loading/svg" + +const ForgotPassword = () => { + const { setAuthTab } = useAuthStore(); + + const [id, setID] = useState(''); + const [isSubmitted, setIsSubmitted] = useState(false); + const [validationState, setValidationState] = useState({ + isIdValid: true, + isOtpValid: true, + isPasswordValid: true + }); + + const handleForgotSubmit = (e: React.FormEvent) => { + e.preventDefault(); + setIsSubmitted(true); + + const trimmedId = id.trim(); + setID(trimmedId); + setValidationState(prevState => ({ + ...prevState, + isIdValid: !!trimmedId + })); + } + + return ( +
+

Account Recover

+
+
+

Email or Username

+ setID(e.target.value)} + className={`${isSubmitted && !validationState.isIdValid ? "shake" : ""}`} + style={{ borderColor: isSubmitted && !validationState.isIdValid ? "red" : "" }} + placeholder='Enter your email or username' + /> +
+ +
+

setAuthTab(AuthTab.Login)}>Go Back

+
+
+
+ ); +}; + +export default ForgotPassword; \ No newline at end of file diff --git a/client/src/components/modal/auth/index.css b/client/src/components/modal/auth/index.css index 5e0e1ed..588ef0c 100644 --- a/client/src/components/modal/auth/index.css +++ b/client/src/components/modal/auth/index.css @@ -83,13 +83,18 @@ #login, #signup, -#brief { +#brief, +#forgot { height: 100%; display: flex; flex-direction: column; justify-content: center; } +#forgot { + gap: 20px; +} + #auth-modal h3 { font-size: 30px; font-weight: 500; @@ -182,7 +187,14 @@ position: absolute; } +#auth-modal .form__container .extra-btn { + display: flex; + align-items: center; + justify-content: space-between; +} + #auth-modal .form__container p { + width: fit-content; font-size: 17px; } @@ -307,6 +319,7 @@ width: 100%; height: 100%; flex-direction: column; + gap: 10px; border: none; border-radius: unset; } @@ -328,13 +341,14 @@ } .auth__container .left__container { + width: 40%; display: flex; margin: 0 auto; overflow-y: unset; } .auth__container .left__container .lottie-anim { - width: 95%; + width: 100%; height: auto; } @@ -352,4 +366,10 @@ #auth-modal .auth__header p { font-size: 16px; } + + #auth-modal .form__container .extra-btn { + /* align-items: flex-start; */ + gap: 10px; + flex-direction: column; + } } \ No newline at end of file diff --git a/client/src/components/modal/auth/index.tsx b/client/src/components/modal/auth/index.tsx index 95ee7ce..0a4b4e5 100644 --- a/client/src/components/modal/auth/index.tsx +++ b/client/src/components/modal/auth/index.tsx @@ -7,6 +7,7 @@ import WavingHand from "../../../lottie/WavingHand.json" import LoginTab from "./login-tab" import SignupTab from "./signup-tab" import BriefInfo from "./brief-info" +import ForgotPassword from "./forgot-password" import { IoCloseOutline } from "react-icons/io5" type RegisterData = { @@ -66,11 +67,13 @@ const AuthModal = () => { registerData={registerData} setRegisterData={setRegisterData} /> - ) : authTab === AuthTab.Info && ( + ) : authTab === AuthTab.Info ? ( + ) : authTab === AuthTab.Forgot && ( + )} <> diff --git a/client/src/components/modal/auth/login-tab.tsx b/client/src/components/modal/auth/login-tab.tsx index c30ee04..43fbb00 100644 --- a/client/src/components/modal/auth/login-tab.tsx +++ b/client/src/components/modal/auth/login-tab.tsx @@ -134,7 +134,10 @@ const LoginTab = () => { -

New here? setAuthTab(AuthTab.Signup)}>Create Account

+
+

New here? setAuthTab(AuthTab.Signup)}>Create Account

+

setAuthTab(AuthTab.Forgot)}>Forgot Password

+
); diff --git a/client/src/components/modal/auth/signup-tab.tsx b/client/src/components/modal/auth/signup-tab.tsx index 4338bd8..1ffa8c2 100644 --- a/client/src/components/modal/auth/signup-tab.tsx +++ b/client/src/components/modal/auth/signup-tab.tsx @@ -112,7 +112,9 @@ const SignupTab: React.FC = ({ registerData, setRegisterData -

Already have an account? setAuthTab(AuthTab.Login)}>Log In

+
+

Already have an account? setAuthTab(AuthTab.Login)}>Log In

+
); diff --git a/client/src/globals.css b/client/src/globals.css index c2a14a4..ab589ed 100644 --- a/client/src/globals.css +++ b/client/src/globals.css @@ -60,7 +60,7 @@ --nav_profile_username: #a6a6a6; --explore_input_bg: #E8E8E8; --explore_input_placeholder: #606060; - --card_background: #ffffff; + --card_background: #f4f4f4; --card_color_primary: #111111; --card_color_secondary: #606060; --card_border: #e5e4e2; @@ -78,7 +78,7 @@ --nav_profile_username: #606060; --explore_input_bg: #1f1f21; --explore_input_placeholder: #a0a0a0; - --card_background: #0a0a0a; + --card_background: #121212; --card_color_primary: #ffffff; --card_color_secondary: #a5a5a5; --card_border: #212122; diff --git a/client/src/store/useAuthStore.ts b/client/src/store/useAuthStore.ts index 1bf64e6..b479e3c 100644 --- a/client/src/store/useAuthStore.ts +++ b/client/src/store/useAuthStore.ts @@ -4,7 +4,8 @@ export enum AuthTab { Closed = 'closed', Login = 'login', Signup = 'signup', - Info = 'info' + Info = 'info', + Forgot = 'forgot', } export enum AuthStatus {