"use strict";
exports.__esModule = true;
exports.ContentCard = exports.cnContentCard = void 0;
var tslib_1 = require("tslib");
// @ts-nocheck
require("./ContentCard.css");
var react_1 = (0, tslib_1.__importDefault)(require("react"));
var IconArrowRight_1 = require("../../icons/IconArrowRight/IconArrowRight");
var bem_1 = require("../../utils/bem");
var getSizeByMap_1 = require("../../utils/getSizeByMap");
var PropsWithAsAttributes_1 = require("../../utils/types/PropsWithAsAttributes");
var Article_1 = require("../Article/Article");
var Button_1 = require("../Button/Button");
var usePropsHandler_1 = require("../EventInterceptor/usePropsHandler");
var Picture_1 = require("../Picture/Picture");
var Typography_1 = require("../Typography/Typography");
var sizeMap = {
    filled: 'sm',
    "default": 'tiny',
    secondary: 'sm'
};
exports.cnContentCard = (0, bem_1.cn)('ContentCard');
exports.ContentCard = (0, PropsWithAsAttributes_1.forwardRefWithAs)(function (props, ref) {
    var _a = (0, usePropsHandler_1.usePropsHandler)((0, exports.cnContentCard)(), props), photo = _a.photo, title = _a.title, titleSize = _a.titleSize, text = _a.text, _b = _a.view, view = _b === void 0 ? 'default' : _b, lineColor = _a.lineColor, picture = _a.picture, linkTitle = _a.linkTitle, color = _a.color, link = _a.link, contentType = _a.contentType, titleTag = _a.titleTag, isInverted = _a.isInverted, pictureAtBottom = _a.pictureAtBottom, otherProps = (0, tslib_1.__rest)(_a, ["photo", "title", "titleSize", "text", "view", "lineColor", "picture", "linkTitle", "color", "link", "contentType", "titleTag", "isInverted", "pictureAtBottom"]);
    return (react_1["default"].createElement("div", (0, tslib_1.__assign)({ className: (0, exports.cnContentCard)({ view: view, isInverted: isInverted, pictureAtBottom: pictureAtBottom }) }, otherProps),
        lineColor && (react_1["default"].createElement("div", { className: (0, exports.cnContentCard)('Line'), style: { backgroundColor: lineColor } })),
        photo && react_1["default"].createElement(Picture_1.Picture, (0, tslib_1.__assign)({}, photo, { className: (0, exports.cnContentCard)('Photo') })),
        picture && react_1["default"].createElement(Picture_1.Picture, (0, tslib_1.__assign)({}, picture, { className: (0, exports.cnContentCard)('Photo') })),
        title && (react_1["default"].createElement(Typography_1.Typography.Title, { size: titleSize !== null && titleSize !== void 0 ? titleSize : (0, getSizeByMap_1.getSizeByMap)(sizeMap, view), className: (0, exports.cnContentCard)('Title'), as: titleTag }, title)),
        text && react_1["default"].createElement(Article_1.Article, { className: (0, exports.cnContentCard)('Text'), content: text }),
        link && view === 'default' && (react_1["default"].createElement("div", { className: (0, exports.cnContentCard)('Button') },
            react_1["default"].createElement(Button_1.Button, { view: "link-primary", isLink: true, label: linkTitle, to: link, iconRight: IconArrowRight_1.IconArrowRight, decorBorder: color === null || color === void 0 ? void 0 : color.replace('#', '') })))));
});
