import React, { useRef, useState } from "react"; import InputCompOne from "../shared/InputCompOne"; interface Option { value: string; label: string; } const BasicInfo: React.FC = () => { const [hideOTPComponent, setHideOTPComponent] = useState(true); const [inputValues, setInputValues] = useState({ title: "", marital: "", agentId: "", bvn: "", firstName: "", phone: "", email: "", surname: "", dob: "", secondName: "", }); const inputRef = useRef(null); // Array for marital status options const maritalStatusOptions: Option[] = [ { value: "", label: "Select" }, { value: "single", label: "Single" }, { value: "married", label: "Married" }, { value: "divorced", label: "Divorced" }, { value: "widowed", label: "Widowed" }, ]; // Array for title options const titleOptions: Option[] = [ { value: "", label: "Select" }, { value: "ms", label: "Ms" }, { value: "mr", label: "Mr" }, { value: "miss", label: "Miss" }, { value: "mrs", label: "Mrs" }, ]; const handleChange = (e: React.ChangeEvent) => { const { name, value } = e.target; setInputValues((prev) => ({ ...prev, [name]: value })); }; const handleInput = (e: React.FormEvent) => { const { name, value } = e.currentTarget; if (name === "bvn") { const regex = /^[0-9]+$/; if (regex.test(value)) { if (value?.length === 10) { setHideOTPComponent(false); // secondInputRef.current?.focus(); } else setHideOTPComponent(true); } else { console.log("object not found"); } } }; return ( <>
{!hideOTPComponent ? (
) : null} ); }; export default BasicInfo;