From d2d6dd952df9669feced1cd73b77bc940a1a1828 Mon Sep 17 00:00:00 2001 From: binh-dam-ibigroup <56846598+binh-dam-ibigroup@users.noreply.github.com> Date: Thu, 10 Sep 2020 11:52:46 -0400 Subject: [PATCH] refactor(ApiUserForm): Combine logic for text field layout. --- components/ApiUserForm.js | 165 ++++++++++++++++---------------------- 1 file changed, 68 insertions(+), 97 deletions(-) diff --git a/components/ApiUserForm.js b/components/ApiUserForm.js index 52a3bb5..9ff1b8b 100644 --- a/components/ApiUserForm.js +++ b/components/ApiUserForm.js @@ -17,6 +17,40 @@ const validationSchema = yup.object({ name: yup.string().required('Please enter your name.') }) +// Field layout (assumes all text fields) +const fieldLayout = [ + { + title: 'Developer information', + fields: [ + { + title: 'Developer name', + field: 'name' + }, + { + title: 'Company', + field: 'company' + } + ] + }, + { + title: 'Application information', + fields: [ + { + title: 'Application name', + field: 'appName' + }, + { + title: 'Application purpose', + field: 'appPurpose' + }, + { + title: 'Application URL', + field: 'appUrl' + } + ] + } +] + /** * Creates a blank ApiUser object to be filled out. */ @@ -85,98 +119,39 @@ class ApiUserForm extends Component {
)} - )