diff --git a/src/components/GetStarted/BVN.tsx b/src/components/GetStarted/BVN.tsx new file mode 100644 index 0000000..f22576a --- /dev/null +++ b/src/components/GetStarted/BVN.tsx @@ -0,0 +1,89 @@ +import React from "react"; +import * as Yup from "yup"; +import { Form, Formik } from "formik"; +import { InputCompOne } from "../shared"; + +// To get the validation schema +const validationSchema = Yup.object().shape({ + bvn: Yup.string() + .required("BVN is required") + .test("no-e", "Invalid number", (value:any) => { + if (value && /^[0-9]*$/.test(value) == false) { + return false; + } + return true; + }) + .min(11, "must be 11 digits") + .max(11, "must be 11 digits") +}); + +// initial values for formik +let initialValues = { + bvn: '' +}; + +type Props = { + handleNextStep:()=>any +} + +const BVN = ({handleNextStep}:Props) => { + + const firstInputRef = React.useRef(null); + + const handleSubmit = (values:any) => { + console.log('values', values) + }; + + return ( + + {(props:any) => ( +
+
+
+
+

+ Let’s Get You Started +

+
+
+ + +

+ ***Every personal information attached to your BVN is safe and secured. It is only inportant for us to verify your information and also give you access to your application profile/account +

+
+
+
+
+ )} +
+ ); +}; + +export default BVN; diff --git a/src/components/GetStarted/DebitAccount.tsx b/src/components/GetStarted/DebitAccount.tsx index fdf554a..ff40d83 100644 --- a/src/components/GetStarted/DebitAccount.tsx +++ b/src/components/GetStarted/DebitAccount.tsx @@ -81,7 +81,7 @@ const DebitAccount: React.FC = () => { className="my-8 max-w-[33.875rem] btn-R bg-[#5A2C82] w-full h-11" text="Apply" type="button" - onClick={()=>navigate(RouteHandler.dashboardHome, {replace:true})} + onClick={()=>navigate(RouteHandler.letsGetStarted, {replace:true})} /> diff --git a/src/components/GetStarted/GetStarted.tsx b/src/components/GetStarted/GetStarted.tsx index 7a1eaf1..e895198 100644 --- a/src/components/GetStarted/GetStarted.tsx +++ b/src/components/GetStarted/GetStarted.tsx @@ -4,14 +4,14 @@ import YourAreAlmostThere from "./YourAreAlmostThere"; import LoanAmountComp from "./LoanAmountComp"; import ApplicantsAttestation from "./ApplicantsAttestation"; -const GetStarted = () => { - const [step, setStep] = React.useState(1); +const GetStarted = ({handleNextStep, step}:{handleNextStep:any, step:string|number|any}) => { + // const [step, setStep] = React.useState(1); - const handleNextStep = () => { - if (step < 4) { - setStep(step + 1); - } - }; + // const handleNextStep = () => { + // if (step < 5) { + // setStep(step + 1); + // } + // }; // const handlePreviousStep: React.MouseEvent = () => { // setStep(step - 1); @@ -36,16 +36,16 @@ const GetStarted = () => {
{/* Main */}
- {step === 1 && ( + {step === 2 && ( )} - {step === 2 && } - {step === 3 && } - {step === 4 && } + {step === 3 && } + {step === 4 && } + {step === 5 && }
diff --git a/src/components/LetsGetStated/LetsGetStarted.tsx b/src/components/LetsGetStated/LetsGetStarted.tsx index 63b5258..e145eb7 100644 --- a/src/components/LetsGetStated/LetsGetStarted.tsx +++ b/src/components/LetsGetStated/LetsGetStarted.tsx @@ -2,6 +2,8 @@ import React from "react"; import * as Yup from "yup"; import { Form, Formik } from "formik"; import { InputCompOne } from ".."; +import {useNavigate} from 'react-router-dom' +import { RouteHandler } from "../../router/routes"; // To get the validation schema const validationSchema = Yup.object().shape({ @@ -40,6 +42,7 @@ let initialValues = { }; const LetsGetStarted: React.FC = () => { + const navigate = useNavigate() // const [pinValues, setPinValues] = React.useState({ // bvn: "", // otp: "", @@ -74,6 +77,7 @@ const LetsGetStarted: React.FC = () => { const handleSubmit = (values:any) => { console.log('values', values) + navigate(RouteHandler.dashboardHome, {replace:true}) }; return ( diff --git a/src/pages/GetStartedPage.tsx b/src/pages/GetStartedPage.tsx index a04fb6c..8707d9d 100644 --- a/src/pages/GetStartedPage.tsx +++ b/src/pages/GetStartedPage.tsx @@ -1,12 +1,28 @@ import React from "react"; import { GetStarted as Main } from "../components"; -import { GetStartedLayout } from "../layouts"; +import { GetStartedLayout, LetsGetStartedLayout } from "../layouts"; +import BVN from "../components/GetStarted/BVN"; const GetStartedPage: React.FC = () => { + const [step, setStep] = React.useState(1); + + const handleNextStep = () => { + if (step < 5) { + setStep(step + 1); + } + }; return ( - -
- + <> + {step == 1 ? + + + + : + +
+ + } + ); };