"use client"; import api from "@/service/api"; import { HTMLInputTypeAttribute } from "react"; import { RegisterOptions, useForm, UseFormRegister } from "react-hook-form"; import { toast } from "react-toastify"; type TContactUsForm = { full_name: string; company_name: string; work_email: string; phone_number: string; }; const ContactUsForm = () => { const { register, handleSubmit, formState: { errors }, } = useForm(); const onSubmit = async (data: TContactUsForm) => { try { const response = (await api.post("inquiries", { ...data })).data; toast.success(response.message); } catch (error) { console.log(error); toast.error("Something went wrong"); throw error; } }; return (
); }; export default ContactUsForm; function InputGroup({ icon, id, label, placeholder, register, type, validation, error, }: { label: string; id: string; icon: () => React.JSX.Element; placeholder: string; register: UseFormRegister; type: HTMLInputTypeAttribute; validation?: RegisterOptions; error?: string; }) { return ( <>
{icon()}
{error &&

{error}

} ); } function UserIcon() { return ( ); }