gab-social/app/javascript/gabsocial/components/form.js
mgabdev 176ddc22f2 Updated the default class name
• Updated:
- the default class name
2020-08-18 15:49:11 -05:00

37 lines
671 B
JavaScript

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