'use strict';

exports.__esModule = true;

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * 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 = _react2.default.Children.map(children, function (child, idx) {
    return _react2.default.cloneElement(child, {
      active: activeIndex === idx ? true : false
    });
  });

  return _react2.default.createElement(
    'div',
    { className: 'cui-tab__content' },
    setPanels
  );
};

TabContent.displayName = 'TabContent';

exports.default = TabContent;
module.exports = exports['default'];