import _snakeCase from "lodash/fp/snakeCase";
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); }
import React from 'react';
import PropTypes from 'prop-types';
import Link from '../../atom/link';
import Tag from '../../atom/tag';
import { COLORS } from '../../variables/colors';
import style from './style.css';
const Tab = ({
  tab,
  index,
  isLightTab
}) => {
  const {
    title,
    href,
    status,
    selected,
    onClick
  } = tab;
  const selectedStyle = isLightTab ? style.selectedlight : style.selected;
  const unselectedStyle = isLightTab ? style.lighttab : style.tab;
  const className = selected ? selectedStyle : unselectedStyle;
  const tagSelectedStyle = {
    backgroundColor: COLORS.primary_100,
    color: COLORS.cm_primary_blue
  };
  return /*#__PURE__*/React.createElement("div", {
    "data-name": `brand_tab_${_snakeCase(title)}`,
    className: className,
    key: index,
    onClick: onClick
  }, /*#__PURE__*/React.createElement(Link, {
    href: href
  }, title), status ? /*#__PURE__*/React.createElement("div", {
    className: style.statusItemWrapper
  }, /*#__PURE__*/React.createElement(Tag, _extends({}, selected && {
    customStyle: tagSelectedStyle
  }, {
    size: "S",
    label: status
  }))) : null);
};
Tab.propTypes = process.env.NODE_ENV !== "production" ? {
  tab: PropTypes.shape({
    title: Link.propTypes.children,
    href: Link.propTypes.href,
    status: PropTypes.string,
    selected: PropTypes.bool,
    onClick: PropTypes.func
  }),
  index: PropTypes.number,
  isLightTab: PropTypes.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.createElement("div", {
    className: isLightTab ? style.lightwrapper : style.wrapper
  }, tabsList);
};
BrandTabs.propTypes = process.env.NODE_ENV !== "production" ? {
  tabs: PropTypes.arrayOf(PropTypes.shape(Tab.propTypes)),
  type: PropTypes.oneOf(['default', 'light'])
} : {};
export default BrandTabs;
//# sourceMappingURL=index.js.map