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

import '../base';
import styles from './FormRow.styl';
import labelStyles from './Label.styl';
import cardStyles from './Card.styl';

export default function FormRow({ children, error, warning, info, success, fixed70, style, ...props }) {

  const classes = classNames({
    [styles.formrow]: true,
    [cardStyles.formrow]: true,
    [labelStyles.container]: true,
    [styles.error]: !!error,
    [labelStyles.error]: !!error,
    [styles.warning]: !!warning,
    [labelStyles.warning]: !!warning,
    [styles.info]: !!info,
    [labelStyles.info]: !!info,
    [styles.success]: !!success,
    [labelStyles.success]: !!success,
    [styles.fixed70]: fixed70
  });


  return (
    <div className={classes} style={style}>
      {children}
    </div>
  );
}

FormRow.propTypes = {
  children: PropTypes.node,
  error: PropTypes.bool,
  warning: PropTypes.bool,
  info: PropTypes.bool,
  success: PropTypes.bool,
  // eslint-disable-next-line react/forbid-prop-types
  style: PropTypes.object
};

FormRow.defaultProps = {
  children: undefined,
  error: undefined,
  warning: undefined,
  info: undefined,
  success: undefined,
  style: undefined
};
