diff --git a/app/_components/FooterForm.tsx b/app/_components/FooterForm.tsx index 415defd..a441061 100644 --- a/app/_components/FooterForm.tsx +++ b/app/_components/FooterForm.tsx @@ -1,9 +1,10 @@ +import { CmsContact } from "@/types/TCms"; import Inquires from "../_inquires/page"; -const FooterForm = () => { +const FooterForm = ({ contactData }: { contactData?: CmsContact }) => { return (
- +
); }; diff --git a/app/_components/InputGroup.tsx b/app/_components/InputGroup.tsx index df12e66..a271d8d 100644 --- a/app/_components/InputGroup.tsx +++ b/app/_components/InputGroup.tsx @@ -9,6 +9,7 @@ function InputGroup({ type, validation, error, + placeholder, }: { label: string; id: string; @@ -16,6 +17,7 @@ function InputGroup({ type: HTMLInputTypeAttribute; validation?: RegisterOptions; error?: string; + placeholder?: string; }) { const [isFocused, setIsFocused] = useState(false); const [hasValue, setHasValue] = useState(false); @@ -40,6 +42,7 @@ function InputGroup({ : "border-gray-200" } p-2 py-3 rounded-lg w-full outline-none`} id={id} + placeholder={placeholder} {...rest} onChange={handleChange} onFocus={() => setIsFocused(true)} diff --git a/app/_inquires/form.tsx b/app/_inquires/form.tsx index 0e1c2b5..58fc3a1 100644 --- a/app/_inquires/form.tsx +++ b/app/_inquires/form.tsx @@ -1,5 +1,6 @@ "use client"; import api from "@/service/api"; +import { CmsContact } from "@/types/TCms"; import { useState } from "react"; import { useForm } from "react-hook-form"; import { toast } from "react-toastify"; @@ -7,20 +8,19 @@ import InputGroup from "../_components/InputGroup"; import Loading from "../_components/Loading"; type TInquiresForm = { - full_name: string; - company_name: string; - work_email: string; - phone_number: string; + [key: string]: string; }; type InquiresFormProps = { columnsPerRow?: 1 | 2 | 3 | 4; buttonText?: string; + contactData?: CmsContact; }; const InquiresForm = ({ columnsPerRow = 2, - buttonText = "Submit", + buttonText, + contactData, }: InquiresFormProps) => { const [isLoading, setIsLoading] = useState(false); const { @@ -59,44 +59,73 @@ const InquiresForm = ({ 4: "lg:col-span-4", }[columnsPerRow]; + const defaultFields = [ + { Name: "full_name", Label: "Full Name", Placeholder: "", Required: false }, + { + Name: "company_name", + Label: "Company Name", + Placeholder: "", + Required: false, + }, + { + Name: "work_email", + Label: "Work Email", + Placeholder: "", + Required: false, + }, + { + Name: "phone_number", + Label: "Phone Number", + Placeholder: "", + Required: false, + }, + ]; + + const fields = contactData?.Fields || defaultFields; + const submitText = contactData?.SubmitButtonText || buttonText || "Submit"; + return (
- - - - + {fields.map((field) => { + const inputType = + field.Name.includes("email") || field.Name === "work_email" + ? "email" + : "text"; + const isPhoneField = + field.Name.includes("phone") || field.Name === "phone_number"; + + return ( + + ); + })}
diff --git a/app/_inquires/page.tsx b/app/_inquires/page.tsx index 92da4dd..c3fa3a5 100644 --- a/app/_inquires/page.tsx +++ b/app/_inquires/page.tsx @@ -1,17 +1,20 @@ +import { CmsContact } from "@/types/TCms"; import InquiresForm from "./form"; -const Inquires = () => { +const Inquires = ({ contactData }: { contactData?: CmsContact }) => { return (
-

Unlock Your Growth Potential

+

+ {contactData?.Title || "Unlock Your Growth Potential"} +

- Register for early access and a free consultation. Let's start winning - together. + {contactData?.Description || + "Register for early access and a free consultation. Let's start winning together."}

- +
); diff --git a/app/marketing/[id]/page.tsx b/app/marketing/[id]/page.tsx index 155a1d7..7b95140 100644 --- a/app/marketing/[id]/page.tsx +++ b/app/marketing/[id]/page.tsx @@ -39,6 +39,7 @@ export default async function Home({ params }: IProps) { } catch (error) { console.error("Error fetching CMS data:", error); } + console.log(cmsData); const centerFrames = [ { @@ -247,7 +248,7 @@ export default async function Home({ params }: IProps) { aria-hidden="true" /> - +