1- import React from 'react' ;
1+ import React , { useEffect } from 'react' ;
22import PropTypes from 'prop-types' ;
33import { Alert } from 'patternfly-react' ;
44
55import { noop } from '../../../common/helpers' ;
66import AlertBody from '../Alert/AlertBody' ;
77import Actions from './Actions' ;
88import { translate as __ } from '../../../../react_app/common/I18n' ;
9+ import { deprecate } from '../../../common/DeprecationService' ;
910
1011const Form = ( {
1112 className,
@@ -17,23 +18,33 @@ const Form = ({
1718 disabled,
1819 submitting,
1920 errorTitle,
20- } ) => (
21- < form className = { className } onSubmit = { onSubmit } >
22- { error && (
23- < Alert className = "base in fade" type = { error . severity || 'danger' } >
24- < AlertBody title = { errorTitle } >
25- { error . errorMsgs . length === 1 ? (
26- < span > { error . errorMsgs [ 0 ] } </ span >
27- ) : (
28- error . errorMsgs . map ( ( e , idx ) => < li key = { idx } > { e } </ li > )
29- ) }
30- </ AlertBody >
31- </ Alert >
32- ) }
33- { children }
34- < Actions onCancel = { onCancel } disabled = { disabled } submitting = { submitting } />
35- </ form >
36- ) ;
21+ } ) => {
22+ useEffect ( ( ) => {
23+ deprecate ( 'Form' , 'Form from @patternfly/react-core' , '3.20' ) ;
24+ } , [ ] ) ;
25+
26+ return (
27+ < form className = { className } onSubmit = { onSubmit } >
28+ { error && (
29+ < Alert className = "base in fade" type = { error . severity || 'danger' } >
30+ < AlertBody title = { errorTitle } >
31+ { error . errorMsgs . length === 1 ? (
32+ < span > { error . errorMsgs [ 0 ] } </ span >
33+ ) : (
34+ error . errorMsgs . map ( ( e , idx ) => < li key = { idx } > { e } </ li > )
35+ ) }
36+ </ AlertBody >
37+ </ Alert >
38+ ) }
39+ { children }
40+ < Actions
41+ onCancel = { onCancel }
42+ disabled = { disabled }
43+ submitting = { submitting }
44+ />
45+ </ form >
46+ ) ;
47+ } ;
3748
3849Form . propTypes = {
3950 children : PropTypes . node ,
0 commit comments