@@ -17,25 +17,41 @@ const GaEventPropTypes = {
1717
1818const RfiLabel = ( { label, name, id, requiredIcon } ) => (
1919 < label htmlFor = { id || name } >
20- { requiredIcon ? (
21- < span title = "Required" >
22- < i className = "fas fa-circle uds-field-required" aria-hidden = "true" />
23- </ span >
24- ) : null }
25-
20+ { requiredIcon && (
21+ < >
22+ < span title = "Required" >
23+ < i className = "fas fa-circle uds-field-required" aria-hidden = "true" />
24+ </ span >
25+
26+ </ >
27+ ) }
2628 { label }
2729 </ label >
2830) ;
2931
32+ const RfiLegend = ( { label, requiredIcon } ) => (
33+ < legend className = "fw-bold" >
34+ { requiredIcon && (
35+ < >
36+ < span title = "Required" >
37+ < i className = "fas fa-circle uds-field-required" aria-hidden = "true" />
38+ </ span >
39+
40+ </ >
41+ ) }
42+ { label }
43+ </ legend >
44+ ) ;
45+
3046const RfiError = ( { isError, metaError } ) => (
3147 < div role = "alert" >
32- { isError ? (
48+ { isError && (
3349 < small className = "form-text invalid-feedback" >
3450 < i className = "fas fa-exclamation-triangle" aria-hidden = "true" />
3551
3652 { metaError }
3753 </ small >
38- ) : null }
54+ ) }
3955 </ div >
4056) ;
4157
@@ -55,6 +71,16 @@ RfiLabel.propTypes = {
5571 requiredIcon : PropTypes . bool ,
5672} ;
5773
74+ RfiLegend . defaultProps = {
75+ label : undefined ,
76+ requiredIcon : undefined ,
77+ } ;
78+
79+ RfiLegend . propTypes = {
80+ label : PropTypes . string . isRequired ,
81+ requiredIcon : PropTypes . bool ,
82+ } ;
83+
5884RfiError . defaultProps = {
5985 isError : undefined ,
6086 metaError : undefined ,
@@ -64,4 +90,4 @@ RfiError.propTypes = {
6490 isError : PropTypes . bool ,
6591 metaError : PropTypes . string ,
6692} ;
67- export { RfiLabel , RfiError , GaEventPropTypes } ;
93+ export { RfiLabel , RfiLegend , RfiError , GaEventPropTypes } ;
0 commit comments