gab-social/app/javascript/gabsocial/components/form.js
mgabdev 7e47bb1d9c Removed prop-types global import, added to files directly
• Removed:
- prop-types global import, added to files directly
2020-08-17 15:59:29 -05:00

40 lines
735 B
JavaScript

import React from 'react'
import PropTypes from 'prop-types'
import Text from './text'
export default class Form extends React.PureComponent {
static propTypes = {
children: PropTypes.any,
errorMessage: PropTypes.string,
onSubmit: PropTypes.func.isRequired,
}
componentDidUpdate (prevProps) {
}
render() {
const {
children,
errorMessage,
onSubmit,
} = this.props
return (
<form onSubmit={onSubmit} className={_s.default}>
{
!!errorMessage &&
<Text color='danger' className={_s.my10}>
{errorMessage}
</Text>
}
<div className={_s.default}>
{children}
</div>
</form>
)
}
}