"use strict";

exports.__esModule = true;
exports.default = void 0;
var _snakeCase2 = _interopRequireDefault(require("lodash/fp/snakeCase"));
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _link = _interopRequireDefault(require("../../atom/link"));
var _tag = _interopRequireDefault(require("../../atom/tag"));
var _colors = require("../../variables/colors");
var _style = _interopRequireDefault(require("./style.css"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
const Tab = ({
  tab,
  index,
  isLightTab
}) => {
  const {
    title,
    href,
    status,
    selected,
    onClick
  } = tab;
  const selectedStyle = isLightTab ? _style.default.selectedlight : _style.default.selected;
  const unselectedStyle = isLightTab ? _style.default.lighttab : _style.default.tab;
  const className = selected ? selectedStyle : unselectedStyle;
  const tagSelectedStyle = {
    backgroundColor: _colors.COLORS.primary_100,
    color: _colors.COLORS.cm_primary_blue
  };
  return /*#__PURE__*/_react.default.createElement("div", {
    "data-name": `brand_tab_${(0, _snakeCase2.default)(title)}`,
    className: className,
    key: index,
    onClick: onClick
  }, /*#__PURE__*/_react.default.createElement(_link.default, {
    href: href
  }, title), status ? /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.statusItemWrapper
  }, /*#__PURE__*/_react.default.createElement(_tag.default, _extends({}, selected && {
    customStyle: tagSelectedStyle
  }, {
    size: "S",
    label: status
  }))) : null);
};
Tab.propTypes = process.env.NODE_ENV !== "production" ? {
  tab: _propTypes.default.shape({
    title: _link.default.propTypes.children,
    href: _link.default.propTypes.href,
    status: _propTypes.default.string,
    selected: _propTypes.default.bool,
    onClick: _propTypes.default.func
  }),
  index: _propTypes.default.number,
  isLightTab: _propTypes.default.bool
} : {};
const BrandTabs = props => {
  const {
    tabs,
    type = 'default'
  } = props;
  const isLightTab = type === 'light';
  const tabsList = tabs.map((tab, index) => Tab({
    tab,
    index,
    isLightTab
  }));
  return /*#__PURE__*/_react.default.createElement("div", {
    className: isLightTab ? _style.default.lightwrapper : _style.default.wrapper
  }, tabsList);
};
BrandTabs.propTypes = process.env.NODE_ENV !== "production" ? {
  tabs: _propTypes.default.arrayOf(_propTypes.default.shape(Tab.propTypes)),
  type: _propTypes.default.oneOf(['default', 'light'])
} : {};
var _default = exports.default = BrandTabs;
//# sourceMappingURL=index.js.map