2020-08-17 21:07:16 +01:00
|
|
|
import React from 'react'
|
2020-08-17 21:59:29 +01:00
|
|
|
import PropTypes from 'prop-types'
|
2020-04-28 06:33:58 +01:00
|
|
|
import Text from './text'
|
|
|
|
|
2020-08-18 01:57:35 +01:00
|
|
|
class Form extends React.PureComponent {
|
2020-04-28 06:33:58 +01:00
|
|
|
|
|
|
|
render() {
|
|
|
|
const {
|
|
|
|
children,
|
|
|
|
errorMessage,
|
|
|
|
onSubmit,
|
|
|
|
} = this.props
|
|
|
|
|
|
|
|
return (
|
2020-08-18 21:49:11 +01:00
|
|
|
<form onSubmit={onSubmit} className={_s.d}>
|
2020-04-28 06:33:58 +01:00
|
|
|
{
|
|
|
|
!!errorMessage &&
|
|
|
|
<Text color='danger' className={_s.my10}>
|
|
|
|
{errorMessage}
|
|
|
|
</Text>
|
|
|
|
}
|
2020-08-18 21:49:11 +01:00
|
|
|
<div className={_s.d}>
|
2020-04-28 06:33:58 +01:00
|
|
|
{children}
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2020-08-18 01:57:35 +01:00
|
|
|
|
|
|
|
Form.propTypes = {
|
|
|
|
children: PropTypes.any,
|
|
|
|
errorMessage: PropTypes.string,
|
|
|
|
onSubmit: PropTypes.func.isRequired,
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Form
|