diff --git a/src/components/auth/OTP.tsx b/src/components/auth/OTP.tsx index f38b260..0e0ee6e 100644 --- a/src/components/auth/OTP.tsx +++ b/src/components/auth/OTP.tsx @@ -1,11 +1,10 @@ import { useEffect, useState } from "react"; -import { Button, FloatLabelInput } from ".."; +import { Button } from ".."; import { useLocation, useNavigate } from "react-router-dom"; import { RouteHandler } from "../../router/routes"; type FormType = { - email: string; - password: string; + [index: string] : string }; type HandleChange = { @@ -17,17 +16,19 @@ export default function Login() { const navigate = useNavigate() const { state } = useLocation(); - let [formDetails, setFormDetails] = useState({ - email: "", - password: "", + let [values, setValues] = useState({ + otp1: "", + otp2: "", + otp3: "", + otp4: "", }); - const handleFormChange = ({ + const handleChange = ({ target: { name, value }, }: { target: HandleChange; }): any => { - setFormDetails((prev) => ({ ...prev, [name]: value })); + setValues((prev:FormType) => ({ ...prev, [name]: value })); }; const handleSubmit = () => { @@ -42,10 +43,20 @@ export default function Login() { } }, []); + useEffect(()=>{ + const formOTP = document.querySelectorAll('input') + for (const i of formOTP) { + if (i.value === '') { + i.focus(); + break; + } + } + },[values]) + return (
-
+
@@ -59,55 +70,47 @@ export default function Login() {
{/* INPUTS */} -
-
- -
-
- -
-
- -
-
- -
+
+ + + +
diff --git a/tailwind.config.js b/tailwind.config.js index d37737f..1c666d9 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -5,7 +5,11 @@ export default { "./src/**/*.{js,ts,jsx,tsx}", ], theme: { - extend: {}, + extend: { + screens:{ + xs: "400px", + } + }, }, plugins: [], }