1
1
import React from 'react' ;
2
2
import PropTypes from 'prop-types' ;
3
- import { FormControl , HelpBlock , Checkbox , FormGroup , ControlLabel } from 'patternfly-react' ;
3
+ import { FormControl , HelpBlock , Checkbox , FormGroup , ControlLabel , FieldLevelHelp } from 'patternfly-react' ;
4
4
import { componentTypes } from '@data-driven-forms/react-form-renderer' ;
5
5
import { validationError } from './helpers' ;
6
6
import MultipleChoiceList from './multiple-choice-list' ;
@@ -69,9 +69,9 @@ const selectComponent = ({
69
69
[ componentTypes . DATE_PICKER ] : ( ) => < DateTimePicker onChange = { input . onChange } isDisabled = { isDisabled } { ...rest } /> ,
70
70
} ) [ componentType ] ;
71
71
72
- const renderHelperText = ( error , helperText ) => ( error // eslint-disable-line no-nested-ternary
72
+ const renderHelperText = ( error , description ) => ( error // eslint-disable-line no-nested-ternary
73
73
? < HelpBlock > { error } </ HelpBlock >
74
- : helperText ? < HelpBlock > { helperText } </ HelpBlock > : null ) ;
74
+ : description ? < HelpBlock > { description } </ HelpBlock > : null ) ;
75
75
76
76
const FinalFormField = ( {
77
77
meta,
@@ -90,10 +90,10 @@ const FinalFormField = ({
90
90
{ label && ! hideLabel && ! noCheckboxLabel &&
91
91
< ControlLabel >
92
92
{ rest . isRequired ? < RequiredLabel label = { label } /> : label }
93
+ { helperText && < FieldLevelHelp content = { helperText } /> }
93
94
</ ControlLabel > }
94
95
{ selectComponent ( { ...rest , invalid, label } ) ( ) }
95
- { description && < HelpBlock style = { { color : '#767676' } } > { description } </ HelpBlock > }
96
- { renderHelperText ( invalid && meta . error , helperText ) }
96
+ { renderHelperText ( invalid && meta . error , description ) }
97
97
</ FormGroup >
98
98
) ;
99
99
} ;
0 commit comments