import React, { forwardRef } from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';

const propTypes = {
  /**
   * The className property allows you to add more classes to the component.
   */
  className: PropTypes.string,

  /**
   * The CallOutDescription content.
   */
  children: PropTypes.node,

  /**
   * The component default class.
   */
  defaultClassName: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),

  /**
   * The component used for the root node.
   * Either a string to use a DOM element or a component.
   */
  tag: PropTypes.elementType,
};

const defaultProps = {
  children: '',
  className: '',
  defaultClassName: 'sui-m-call-out__description',
  tag: 'div',
};

export const CallOutDescription = forwardRef(({
  children, className, defaultClassName, tag: Tag, ...props
}, ref) => (
  <Tag className={classnames(defaultClassName, className)} {...props} ref={ref}>
    {children}
  </Tag>
));

CallOutDescription.propTypes = propTypes;
CallOutDescription.defaultProps = defaultProps;
