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

const propTypes = {
  children: PropTypes.node,
  className: PropTypes.string,
  defaultClassName: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
  tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
};

const defaultProps = {
  children: '',
  className: '',
  defaultClassName: 'sui-o-modal__footer',
  tag: 'div',
};

export const ModalFooter = ({
  children, className, defaultClassName, tag: Tag,
}) => (
  <Tag className={classnames(defaultClassName, className)}>
    {children}
  </Tag>
);

ModalFooter.propTypes = propTypes;
ModalFooter.defaultProps = defaultProps;
