@@ -3,7 +3,7 @@ import React, { useState } from "react";
3
3
import { ErrorList } from "./error-list" ;
4
4
5
5
6
- const CheckboxInput = ( { name, id, value, label, disabled, onChange} ) => {
6
+ const CheckboxInput = ( { name, id, value, label, disabled, onChange, helpText } ) => {
7
7
return (
8
8
< div className = "checkbox-row" >
9
9
< input
@@ -19,12 +19,13 @@ const CheckboxInput = ({name, id, value, label, disabled, onChange}) => {
19
19
} }
20
20
/>
21
21
{ label ? < label className = "vCheckboxLabel" htmlFor = { id } > { label } </ label > : null }
22
+ { helpText ? < div > < span className = "help" htmlFor = { id } > { helpText } </ span > </ div > : null }
22
23
</ div >
23
24
) ;
24
25
} ;
25
26
26
27
27
- const TextInput = ( { id, name, value, label, onChange, hidden} ) => {
28
+ const TextInput = ( { id, name, value, label, onChange, hidden, helpText } ) => {
28
29
29
30
return (
30
31
< div >
@@ -41,12 +42,13 @@ const TextInput = ({id, name, value, label, onChange, hidden}) => {
41
42
} }
42
43
value = { value }
43
44
/>
45
+ { helpText ? < div > < span className = "help" htmlFor = { id } > { helpText } </ span > </ div > : null }
44
46
</ div >
45
47
) ;
46
48
} ;
47
49
48
50
49
- const SelectInput = ( { choices, name, id, label, onChange, initialValue, errors} ) => {
51
+ const SelectInput = ( { choices, name, id, label, onChange, initialValue, errors, helpText } ) => {
50
52
51
53
const [ currentValue , setCurrentValue ] = useState ( initialValue || "" ) ;
52
54
const [ _errors , setErrors ] = useState ( errors || [ ] ) ;
@@ -74,6 +76,7 @@ const SelectInput = ({choices, name, id, label, onChange, initialValue, errors})
74
76
>
75
77
{ options }
76
78
</ select >
79
+ { helpText ? < div > < span className = "help" htmlFor = { id } > { helpText } </ span > </ div > : null }
77
80
</ div >
78
81
)
79
82
}
0 commit comments