/**
 * imui.FormRow
 * @author moxhe
 * @date 2016-08-08
 */

import React from 'react';
import classnames from 'classnames';
import PropTypes from 'prop-types';

function FormRow(props) {
  const { prefixCls, className, inline, ...others } = props;

  const allCls = {
    [prefixCls]: true,
    [className]: !!className,
    [`${prefixCls}--inline`]: inline
  };

  return (
    <div {...others} className={classnames(allCls)}>
      {props.children}
    </div>
  );
}

/**
 * 是否设置此FormRow元素为display: inline-block
 */
FormRow.propTypes = {
  inline: PropTypes.bool
};

FormRow.defaultProps = {
  prefixCls: 'im-form-row'
};

export default FormRow;
