message: Rewrite FormLayout
diff: -
  import React, { Children } from 'react';
  import PropTypes from 'prop-types';
  import getClassName from '../../helpers/getClassName';
  @@ -6,49 +5,59 @@ 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();
  +const preventDefault = e => e.preventDefault();
  - render () {
  +export const FormLayout = props => {
  const {
  children,
  TagName,
  className,
  getRef,
  + onSubmit,
  ...restProps
  - } = this.props;
  + } = props;
  return (
  <TagName
  {...restProps}
  className={classNames(baseClassName, className)}
  - onSubmit={this.onSubmit}
  + onSubmit={onSubmit}
  ref={getRef}
  >
  <div className="FormLayout__container">
  - {Children.toArray(children).map((field, i) => (
  - field ? <div className="FormLayout__row" key={field.key || `row-${i}`}>
  - {field.props.top && <div className="FormLayout__row-top">{field.props.top}</div>}
  + {Children.toArray(children).map((field, i) =>
  + field ? (
  + <div className="FormLayout__row" key={field.key || `row-${i}`}>
  + {field.props.top && (
  + <div className="FormLayout__row-top">{field.props.top}</div>
  + )}
  <div className="FormLayout__field">{field}</div>
  - {field.props.bottom && <div className="FormLayout__row-bottom">{field.props.bottom}</div>}
  - </div> : null
  - ))}
  + {field.props.bottom && (
  + <div className="FormLayout__row-bottom">
  + {field.props.bottom}
  + </div>
  + )}
  </div>
  - {TagName === 'form' && <input type="submit" className="FormLayout__submit" value="" />}
  + ) : null,
  + )}
  + </div>
  + {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',
  + onSubmit: preventDefault
  +};
  