feat(inquires): Make contact form configurable via CMS data
- Add CmsContact type support to FooterForm, Inquires, and InquiresForm components - Make form fields dynamic by accepting contactData prop with configurable Fields array - Add placeholder prop to InputGroup component for enhanced field customization - Replace hardcoded form fields with dynamic field mapping from CMS data - Support dynamic form title and description from contactData - Use CMS-provided submit button text with fallback to default "Submit" - Implement field-level validation configuration including required field handling - Auto-detect input type based on field name (email, phone, text) - Pass contact data from marketing page to FooterForm component - Maintain backward compatibility with default fields when contactData is not provided
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import { CmsContact } from "@/types/TCms";
|
||||
import Inquires from "../_inquires/page";
|
||||
|
||||
const FooterForm = () => {
|
||||
const FooterForm = ({ contactData }: { contactData?: CmsContact }) => {
|
||||
return (
|
||||
<div className="absolute w-full -top-[420px] lg:-top-72 z-10">
|
||||
<Inquires />
|
||||
<Inquires contactData={contactData} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -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)}
|
||||
|
||||
Reference in New Issue
Block a user