import React from 'react';
import PropTypes from 'prop-types';
/**
 * TabContent helps organize the TabPanes and provides the Tab-content CSS wrapper;
 * @param props
 * @returns {XML}
 * @constructor
 */

var TabContent = function TabContent(props) {
  var children = props.children,
      activeIndex = props.activeIndex;
  var setPanels = React.Children.map(children, function (child, idx) {
    return React.cloneElement(child, {
      active: activeIndex === idx ? true : false
    });
  });
  return React.createElement("div", {
    className: "cui-tab__content"
  }, setPanels);
};

TabContent.propTypes = {
  /**
   * optional children prop type
   */
  activeIndex: PropTypes.number,

  /**
   * optional children prop type
   */
  children: PropTypes.node
};
TabContent.displayName = 'TabContent';
export default TabContent;