@@ -9,6 +9,7 @@ import styles from './FormGroupItem.module.scss'
99
1010interface FormGroupItemProps {
1111 group : FormGroup
12+ renderDividers ?: boolean
1213 renderFormInput : ( input : FormInputModel , index : number ) => JSX . Element | undefined
1314 totalGroupCount : number
1415}
@@ -19,10 +20,11 @@ interface ItemRowProps {
1920 hasMultipleGroups : boolean ,
2021 instructions ?: string | undefined ,
2122 isMultiFieldGroup : boolean ,
23+ renderDividers ?: boolean
2224 title ?: string ,
2325}
2426
25- const TwoColumnItem : React . FC < ItemRowProps > = ( { element, formInputs, hasMultipleGroups, instructions, isMultiFieldGroup, title } : ItemRowProps ) => {
27+ const TwoColumnItem : React . FC < ItemRowProps > = ( { element, formInputs, hasMultipleGroups, instructions, isMultiFieldGroup, title, renderDividers } : ItemRowProps ) => {
2628 return (
2729 < >
2830 < div className = { cn ( styles [ 'form-group-item' ] , ! isMultiFieldGroup && styles [ 'single-field' ] ) } >
@@ -41,7 +43,9 @@ const TwoColumnItem: React.FC<ItemRowProps> = ({ element, formInputs, hasMultipl
4143 { formInputs }
4244 </ div >
4345 </ div >
44- < PageDivider styleNames = { [ ! hasMultipleGroups ? 'spacingSmall' : '' ] } />
46+ {
47+ renderDividers !== false && < PageDivider styleNames = { [ ! hasMultipleGroups ? 'spacingSmall' : '' ] } />
48+ }
4549 </ >
4650 )
4751}
@@ -67,7 +71,7 @@ const SingleColumnItem: React.FC<ItemRowProps> = ({ formInputs, hasMultipleGroup
6771 )
6872}
6973
70- const FormGroupItem : React . FC < FormGroupItemProps > = ( { group, renderFormInput, totalGroupCount } : FormGroupItemProps ) => {
74+ const FormGroupItem : React . FC < FormGroupItemProps > = ( { group, renderDividers , renderFormInput, totalGroupCount } : FormGroupItemProps ) => {
7175 const { instructions, title, inputs, element } : FormGroup = group
7276
7377 const formInputs : Array < JSX . Element | undefined > = inputs ?. map ( ( field : FormInputModel , index : number ) => renderFormInput ( field as FormInputModel , index ) ) || [ ]
@@ -77,7 +81,7 @@ const FormGroupItem: React.FC<FormGroupItemProps> = ({ group, renderFormInput, t
7781
7882 return isCardSet ?
7983 < SingleColumnItem hasMultipleGroups = { hasMultipleGroups } instructions = { instructions } isMultiFieldGroup = { isMultiFieldGroup } formInputs = { formInputs } title = { title } /> :
80- < TwoColumnItem hasMultipleGroups = { hasMultipleGroups } element = { element } instructions = { instructions } isMultiFieldGroup = { isMultiFieldGroup } formInputs = { formInputs } title = { title } />
84+ < TwoColumnItem hasMultipleGroups = { hasMultipleGroups } element = { element } instructions = { instructions } isMultiFieldGroup = { isMultiFieldGroup } formInputs = { formInputs } title = { title } renderDividers = { renderDividers } />
8185}
8286
8387export default FormGroupItem
0 commit comments