Skip to content

Commit

Permalink
[DUOS-2033][risk=no] Update ResearcherProfile to use FormField compon…
Browse files Browse the repository at this point in the history
…ents (#1814)

* researcher profile use formfield

* undo

* feedback

* feedbac

* maybe fix?
  • Loading branch information
connorlbark authored Oct 11, 2022
1 parent 482c6b2 commit a6d49f2
Show file tree
Hide file tree
Showing 3 changed files with 140 additions and 126 deletions.
9 changes: 2 additions & 7 deletions src/components/forms/formUtils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FormFieldTypes, commonRequiredProps, commonOptionalProps } from './forms';
import { isNil, isFunction, isArray, isEmpty, isString } from 'lodash/fp';
import { isNil, isFunction, isArray, isString } from 'lodash/fp';
import { isEmailAddress } from '../../libs/utils';

export const validateFormProps = (props) => {
Expand Down Expand Up @@ -43,18 +43,13 @@ export const customSelectPropValidation = (props) => {
throw 'prop \'selectOptions\' must be an array';
}

if (isEmpty(props.selectOptions)) {
throw '\'selectOptions\' cannot be empty';
}

const isStringArr = isString(props.selectOptions[0]);
const isStringArr = props.selectOptions.length > 0 && isString(props.selectOptions[0]);

props.selectOptions.forEach((opt) => {
if (isStringArr) {
if (!isString(opt)) {
throw 'all values in \'selectOptions\' must be string typed';
}

return;
}

Expand Down
4 changes: 3 additions & 1 deletion src/components/forms/forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ export const commonOptionalProps = [
'hideTitle',
'style',
'validators',
'type'
'onChange',
'type',
'key',
];

// ----------------------------------------------------------------------------------------------------- //
Expand Down
Loading

0 comments on commit a6d49f2

Please sign in to comment.