From 6b68dee958c9f4bb6906b088459f820b7a682776 Mon Sep 17 00:00:00 2001 From: ali josheghani Date: Tue, 4 Jun 2024 00:07:41 +0330 Subject: [PATCH] feat : add code verifaction for authorization --- src/pages/login/index.tsx | 70 +++++++++++++++++-- .../shop/section/bestQuality/BestQuality.tsx | 2 +- src/pages/shop/section/intro/Intro.tsx | 2 +- .../productList/components/ListAllProduct.tsx | 2 +- .../section/components/ListTutorial.tsx | 2 +- src/types/props.d.ts | 13 ++-- 6 files changed, 77 insertions(+), 14 deletions(-) diff --git a/src/pages/login/index.tsx b/src/pages/login/index.tsx index 0909300..58b4cfd 100644 --- a/src/pages/login/index.tsx +++ b/src/pages/login/index.tsx @@ -4,27 +4,44 @@ import { useState } from "react"; import LoginNumberOrEmail from "./components/LoginNumberOrEmail"; import { motion } from "framer-motion"; import Rabbit from "./components/Rabbit"; +import OTPInput from "react-otp-input"; const Login = () => { const [loginWithEmail, setLoginWithEmail] = useState(false); const [inputText, setInputText] = useState(false); const [inputPassword, setInputPassword] = useState(false); + const [authCode, setAuthCode] = useState(false); + const [errorCode, setErrorCode] = useState(false); + + const [otp, setOtp] = useState(""); + + const handleChange = (otp: string) => { + setOtp(otp); + if (otp === "1111" && otp.length === 4) + setAuthCode(true), setErrorCode(false); + else if (otp.length === 4) setErrorCode(true), setAuthCode(false); + else setAuthCode(false), setErrorCode(false); + }; + return ( <>
- + {/* */}

ورود

- + کد ارسال شده رو وارد نمایید: + + {/* + /> */}
- {!loginWithEmail && ( + {/* {!loginWithEmail && ( { onBlur={() => setInputText(false)} /> - )} + )} */} + ( + + )} + />
- +
diff --git a/src/pages/shop/section/bestQuality/BestQuality.tsx b/src/pages/shop/section/bestQuality/BestQuality.tsx index acd5841..9928d12 100644 --- a/src/pages/shop/section/bestQuality/BestQuality.tsx +++ b/src/pages/shop/section/bestQuality/BestQuality.tsx @@ -9,7 +9,7 @@ const BestQuality = () => {

به عنوان{" "} - + اولین و بهترین {" "} ارائه دهنده{" "} diff --git a/src/pages/shop/section/intro/Intro.tsx b/src/pages/shop/section/intro/Intro.tsx index e3537e2..6d76660 100644 --- a/src/pages/shop/section/intro/Intro.tsx +++ b/src/pages/shop/section/intro/Intro.tsx @@ -8,7 +8,7 @@ const Intro = () => {

بزرگترین فروشگاه - + کاهش پینگ {" "} در ایران diff --git a/src/pages/shop/section/productList/components/ListAllProduct.tsx b/src/pages/shop/section/productList/components/ListAllProduct.tsx index a11dbc7..b8336c7 100644 --- a/src/pages/shop/section/productList/components/ListAllProduct.tsx +++ b/src/pages/shop/section/productList/components/ListAllProduct.tsx @@ -63,7 +63,7 @@ const ListAllProduct = ({ activeId }: { activeId: number }) => { }, [activeId]); return ( -
+
{dataProduct?.map((item) => { return ( diff --git a/src/pages/tutorial/section/components/ListTutorial.tsx b/src/pages/tutorial/section/components/ListTutorial.tsx index 80facc1..14f4305 100644 --- a/src/pages/tutorial/section/components/ListTutorial.tsx +++ b/src/pages/tutorial/section/components/ListTutorial.tsx @@ -12,7 +12,7 @@ const ListTutorials = ({ return (
  • setActiveTutorial(i.id)} key={i.id} diff --git a/src/types/props.d.ts b/src/types/props.d.ts index 924b506..af46620 100644 --- a/src/types/props.d.ts +++ b/src/types/props.d.ts @@ -66,18 +66,18 @@ export type LearnProps = { }; // begin TypeWriter.tsx -interface TypewriterProps { +export interface TypewriterProps { text: string; speed?: number; // سرعت تایپ در میلی‌ثانیه } -interface ButtonListProps { +export interface ButtonListProps { ProductsList: { id: number; title: string }[]; activeId: number; setActiveId: SetStateAction; } -interface ProductBoxProps { +export interface ProductBoxProps { title: string; space: number; users: number; @@ -86,7 +86,7 @@ interface ProductBoxProps { variant: number; } -interface InputProps extends InputHTMLAttributes { +export interface InputProps extends InputHTMLAttributes { label: string; id?: string; type: string; @@ -94,3 +94,8 @@ interface InputProps extends InputHTMLAttributes { placeholder?: string; extra?: string; } + +export interface MuiModalProps { + isOpenModal: boolean; + setIsOpenModal:SetStateAction +}