From 973b6b5e7d7f755d7552606621d2e588159287ed Mon Sep 17 00:00:00 2001 From: Teriuihi Date: Wed, 7 Aug 2024 00:41:11 +0200 Subject: [PATCH] Add titles to form data and display them dynamically Incorporated 'title' property into form data objects for dynamic rendering in the GenericForm component. This enhancement facilitates the use of specific titles for different forms, improving readability and user experience. --- src/components/form/data/apply.tsx | 3 ++- src/components/form/data/contact.tsx | 3 ++- src/components/form/formInterfaces.tsx | 1 + src/components/form/genericForm.tsx | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/form/data/apply.tsx b/src/components/form/data/apply.tsx index bd26845..e44a7ae 100644 --- a/src/components/form/data/apply.tsx +++ b/src/components/form/data/apply.tsx @@ -202,5 +202,6 @@ export const apply: FormData = { other: Yup.string() .max(2000, 'Please provide at most 2000 characters') - }) + }), + title: "Staff Application" }; \ No newline at end of file diff --git a/src/components/form/data/contact.tsx b/src/components/form/data/contact.tsx index 2553b6f..a040bf1 100644 --- a/src/components/form/data/contact.tsx +++ b/src/components/form/data/contact.tsx @@ -47,5 +47,6 @@ export const contact: FormData = { .min(10, 'Question should be at least 10 characters') .max(2000, 'Question should not exceed 2000 characters') .required('Question is required') - }) + }), + title: "Contact Form" }; \ No newline at end of file diff --git a/src/components/form/formInterfaces.tsx b/src/components/form/formInterfaces.tsx index 08f4d10..45e0b7d 100644 --- a/src/components/form/formInterfaces.tsx +++ b/src/components/form/formInterfaces.tsx @@ -22,6 +22,7 @@ export type FormData = { backend: string; userInput: UserInput; spec: Yup.Schema + title: string; } export interface FormProperties { diff --git a/src/components/form/genericForm.tsx b/src/components/form/genericForm.tsx index 774d791..8bdd067 100644 --- a/src/components/form/genericForm.tsx +++ b/src/components/form/genericForm.tsx @@ -60,7 +60,7 @@ const GenericForm = (formData: FormData) => { return (
-

Contact Form

+

{formData.title}