message: Rewrite FormLayout to stateless component
diff: -
  import React from 'react';
  import PropTypes from 'prop-types';
  import getClassName from '../../helpers/getClassName';
  @@ -6,37 +5,23 @@ import classNames from '../../lib/classNames';
  const baseClassName = getClassName('FormLayout');
  -export default class FormLayout extends React.Component {
  - static propTypes = {
  - children: PropTypes.node,
  - className: PropTypes.string,
  - TagName: PropTypes.string,
  - onSubmit: PropTypes.func,
  - getRef: PropTypes.func
  - };
  -
  - static defaultProps = {
  - status: 'default',
  - TagName: 'form'
  - };
  -
  - onSubmit = (e) => this.props.onSubmit ? this.props.onSubmit(e) : e.preventDefault();
  -
  - render () {
  +const FormLayout = props => {
  const {
  children,
  TagName,
  className,
  getRef,
  ...restProps
  - } = this.props;
  + } = props;
  const arrayChildren = Array.isArray(children) ? children : [children];
  + const onSubmit = (e) => props.onSubmit ? props.onSubmit(e) : e.preventDefault();
  +
  return (
  <TagName
  {...restProps}
  className={classNames(baseClassName, className)}
  - onSubmit={this.onSubmit}
  + onSubmit={onSubmit}
  ref={getRef}
  >
  <div className="FormLayout__container">
  @@ -51,5 +36,19 @@ export default class FormLayout extends React.Component {
  {TagName === 'form' && <input type="submit" className="FormLayout__submit" value="" />}
  </TagName>
  );
  - }
  -}
  +};
  +
  +FormLayout.propTypes = {
  + children: PropTypes.node,
  + className: PropTypes.string,
  + TagName: PropTypes.string,
  + onSubmit: PropTypes.func,
  + getRef: PropTypes.func
  +};
  +
  +FormLayout.defaultProps = {
  + status: 'default',
  + TagName: 'form'
  +};
  +
  +export default FormLayout;
  