"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const react_1 = __importDefault(require("react"));
const antd_1 = require("antd");
const prop_types_1 = __importDefault(require("prop-types"));
const styled_components_1 = __importDefault(require("styled-components"));
const index_1 = require("@/components/index");
const MAX_LOCALE_SHOW = 5;
const MoreContent = styled_components_1.default.div `
  display: inline-block;
  padding: 0 8px;
  :hover {
    background-color: #efefef;
    cursor: default;
  }
`;
function LocalsView(props) {
    const { locales, maxLocaleCount = MAX_LOCALE_SHOW } = props;
    return (react_1.default.createElement("span", null,
        locales &&
            locales.map((tag, idx) => {
                if (idx < maxLocaleCount) {
                    return (react_1.default.createElement(index_1.LocaleTag, { color: "green", key: tag }, tag));
                }
                return null;
            }),
        locales && locales.length > maxLocaleCount && (react_1.default.createElement(antd_1.Tooltip, { title: locales.slice(maxLocaleCount, locales.length).join(', ') },
            react_1.default.createElement(MoreContent, { title: `More ${locales.length - maxLocaleCount} locales` },
                "... (More ",
                locales.length - maxLocaleCount,
                " locales)",
                ' ')))));
}
LocalsView.defaultProps = {
    locales: [],
};
LocalsView.propTypes = {
    locales: prop_types_1.default.array,
};
exports.default = LocalsView;
