"use strict";
exports.__esModule = true;
exports.NewsCard = exports.cnNewsCard = exports.cardPropViewDefault = exports.cardPropView = exports.cardPropSizeDefault = exports.cardPropSize = void 0;
var tslib_1 = require("tslib");
/* eslint-disable jsx-a11y/anchor-has-content */
/* eslint-disable jsx-a11y/control-has-associated-label */
// @ts-nocheck
require("./NewsCard.css");
var react_1 = (0, tslib_1.__importDefault)(require("react"));
var react_router_dom_1 = require("react-router-dom");
var IconArrowRight_1 = require("../../icons/IconArrowRight/IconArrowRight");
var bem_1 = require("../../utils/bem");
var getSizeByMap_1 = require("../../utils/getSizeByMap");
var Article_1 = require("../Article/Article");
var Button_1 = require("../Button/Button");
var Picture_1 = require("../Picture/Picture");
var Typography_1 = require("../Typography");
exports.cardPropSize = ['m'];
exports.cardPropSizeDefault = exports.cardPropSize[0];
exports.cardPropView = ['default', 'text'];
exports.cardPropViewDefault = exports.cardPropView[0];
var sizeMapTitle = {
    s: 'tiny',
    m: 'sm'
};
exports.cnNewsCard = (0, bem_1.cn)('NewsCard');
exports.NewsCard = react_1["default"].forwardRef(function (props, ref) {
    var className = props.className, _a = props.size, size = _a === void 0 ? exports.cardPropSizeDefault : _a, _b = props.view, view = _b === void 0 ? exports.cardPropViewDefault : _b, intro = props.intro, title = props.title, path = props.path, picture = props.picture, date = props.date, location = props.location, labelButton = props.labelButton;
    return (react_1["default"].createElement("div", { className: (0, exports.cnNewsCard)({ size: size, view: view }, [className]) },
        path && react_1["default"].createElement(react_router_dom_1.NavLink, { className: (0, exports.cnNewsCard)('Link'), to: path }),
        picture && (react_1["default"].createElement("div", { className: (0, exports.cnNewsCard)('Picture') },
            react_1["default"].createElement(Picture_1.Picture, (0, tslib_1.__assign)({}, picture)))),
        react_1["default"].createElement("div", { className: (0, exports.cnNewsCard)('Body') },
            react_1["default"].createElement("div", { className: (0, exports.cnNewsCard)('Head') },
                date && (react_1["default"].createElement(Typography_1.Typography.Text, { size: "xs", weight: "bold", transform: "uppercase" }, date)),
                location && (react_1["default"].createElement(Typography_1.Typography.Text, { size: "xs", weight: "bold", transform: "uppercase" }, location))),
            react_1["default"].createElement(Typography_1.Typography.Title, { size: (0, getSizeByMap_1.getSizeByMap)(sizeMapTitle, size), className: (0, exports.cnNewsCard)('Title') }, title),
            intro && react_1["default"].createElement(Article_1.Article, { content: intro, className: (0, exports.cnNewsCard)('Description') }),
            path && labelButton && (react_1["default"].createElement("div", { className: (0, exports.cnNewsCard)('Button') },
                react_1["default"].createElement(Button_1.Button, { view: "link-secondary", label: labelButton, iconRight: IconArrowRight_1.IconArrowRight, isLink: !!path, to: path }))))));
});
