From 2dd142324dc59874c0eea0c8e4f43f1c0163b20b Mon Sep 17 00:00:00 2001 From: awlfccamp Date: Thu, 10 Oct 2024 13:15:47 -0500 Subject: [PATCH] adapt ValidatedTextField to accept custom validation functions --- client/src/components/ProjectForm.jsx | 16 +++- .../parts/form/ValidatedTextField.jsx | 91 ++++++++++--------- 2 files changed, 65 insertions(+), 42 deletions(-) diff --git a/client/src/components/ProjectForm.jsx b/client/src/components/ProjectForm.jsx index d0c4efc05..4a35628f8 100644 --- a/client/src/components/ProjectForm.jsx +++ b/client/src/components/ProjectForm.jsx @@ -22,6 +22,7 @@ import { ReactComponent as PlusIcon } from '../svg/PlusIcon.svg'; import ValidatedTextField from './parts/form/ValidatedTextField'; import TitledBox from './parts/boxes/TitledBox'; import ChangesModal from './ChangesModal'; +import { simpleInputs, additionalInputsForEdit } from './data'; /** STYLES * -most TextField and InputLabel styles are controlled by the theme @@ -249,7 +250,7 @@ export default function ProjectForm({ isEdit ? submitEditProject(data) : submitNewProject(data); })} > - {arr.map((input) => ( + {simpleInputs.map((input) => ( ))} + {isEdit && + additionalInputsForEdit.map((input) => ( + + ))} - - - - {input.label} - + + + + + {input.label} + + + {input.name === 'location' && locationRadios} - {input.name === 'location' && locationRadios} - - - + + ); -}; +} -export default ValidatedTextField; \ No newline at end of file +export default ValidatedTextField;