function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

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

var Tab = function (_React$Component) {
  _inherits(Tab, _React$Component);

  function Tab() {
    var _temp, _this, _ret;

    _classCallCheck(this, Tab);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.onClick = function () {
      var _this$props = _this.props,
          label = _this$props.label,
          onClick = _this$props.onClick;

      onClick(label);
    }, _temp), _possibleConstructorReturn(_this, _ret);
  }

  Tab.prototype.render = function render() {
    var onClick = this.onClick,
        _props = this.props,
        activeTab = _props.activeTab,
        label = _props.label;


    var className = 'Tabs-listItem';
    if (activeTab === label) className += ' Tabs-listItem_active';

    return React.createElement(
      'li',
      { className: className, onClick: onClick, onKeyDown: onClick },
      label
    );
  };

  return Tab;
}(React.Component);

Tab.propTypes = process.env.NODE_ENV !== "production" ? {
  activeTab: PropTypes.any.isRequired,
  className: PropTypes.string,
  label: PropTypes.any.isRequired,
  onClick: PropTypes.func.isRequired
} : {};


export default Tab;