"use strict";
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
    if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
    return cooked;
};
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
    result["default"] = mod;
    return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var React = __importStar(require("react"));
var styled_components_1 = __importDefault(require("styled-components"));
var styleConstants_1 = require("../styleConstants");
var StyledLi = styled_components_1.default.li(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n  border-bottom: ", ";\n  box-sizing: border-box;\n  font-family: ", ";\n  font-weight: ", ";\n  margin-bottom: 0;\n  padding: 3px 0 18px;\n  text-align: center;\n  cursor: ", ";\n\n  & a {\n    color: inherit;\n  }\n  flex-grow: 1;\n"], ["\n  border-bottom: ", ";\n  box-sizing: border-box;\n  font-family: ", ";\n  font-weight: ", ";\n  margin-bottom: 0;\n  padding: 3px 0 18px;\n  text-align: center;\n  cursor: ", ";\n\n  & a {\n    color: inherit;\n  }\n  flex-grow: 1;\n"])), function (props) { return (props.isActive ? "3px solid #01a0d2" : "none"); }, function (props) { return props.theme.sansSerifFont; }, function (props) { return (props.isActive ? "600" : "400"); }, function (props) { return (props.isActive ? "default" : "pointer"); });
StyledLi.defaultProps = {
    theme: {
        sansSerifFont: styleConstants_1.fonts.SANS_SERIF,
    },
};
exports.Count = styled_components_1.default.span(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n  font-weight: 400;\n"], ["\n  font-weight: 400;\n"])));
var StyledBadge = styled_components_1.default.figure(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n  position: absolute;\n  top: -20px;\n  right: -60px;\n  border-radius: 10px;\n  background: ", ";\n  color: white;\n  font-size: 10px;\n  font-weight: 400;\n  width: 20px;\n  height: 20px;\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  justify-content: space-around;\n"], ["\n  position: absolute;\n  top: -20px;\n  right: -60px;\n  border-radius: 10px;\n  background: ", ";\n  color: white;\n  font-size: 10px;\n  font-weight: 400;\n  width: 20px;\n  height: 20px;\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  justify-content: space-around;\n"])), styleConstants_1.colors.accent.CIVIL_RED_2);
var StyledTabTitle = styled_components_1.default.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n  position: relative;\n  display: inline-block;\n"], ["\n  position: relative;\n  display: inline-block;\n"])));
var Tab = /** @class */ (function (_super) {
    __extends(Tab, _super);
    function Tab() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.onClick = function () {
            _this.props.onClick(_this.props.index);
        };
        return _this;
    }
    Tab.prototype.render = function () {
        var badgeNum = this.props.badgeNum;
        var TabComponent = this.props.TabComponent || StyledLi;
        var displayBadge = badgeNum && badgeNum > 0;
        var badgeCount = "";
        if (displayBadge) {
            if (badgeNum > 99) {
                badgeCount = "99+";
            }
            else {
                badgeCount = badgeNum + "";
            }
        }
        return (React.createElement(TabComponent, { isActive: this.props.isActive, isResponsiveAndVisible: this.props.isResponsiveAndVisible, onClick: this.onClick },
            React.createElement(StyledTabTitle, null,
                this.props.title,
                displayBadge && React.createElement(StyledBadge, null, badgeCount))));
    };
    return Tab;
}(React.Component));
exports.Tab = Tab;
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
//# sourceMappingURL=Tab.js.map