import { __assign, __rest } from "tslib";
// @ts-nocheck
import './ContentCard.css';
import React from 'react';
import { IconArrowRight } from '../../icons/IconArrowRight/IconArrowRight';
import { cn } from '../../utils/bem';
import { getSizeByMap } from '../../utils/getSizeByMap';
import { forwardRefWithAs } from '../../utils/types/PropsWithAsAttributes';
import { Article } from '../Article/Article';
import { Button } from '../Button/Button';
import { usePropsHandler } from '../EventInterceptor/usePropsHandler';
import { Picture } from '../Picture/Picture';
import { Typography } from '../Typography/Typography';
var sizeMap = {
    filled: 'sm',
    "default": 'tiny',
    secondary: 'sm'
};
export var cnContentCard = cn('ContentCard');
export var ContentCard = forwardRefWithAs(function (props, ref) {
    var _a = usePropsHandler(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 = __rest(_a, ["photo", "title", "titleSize", "text", "view", "lineColor", "picture", "linkTitle", "color", "link", "contentType", "titleTag", "isInverted", "pictureAtBottom"]);
    return (React.createElement("div", __assign({ className: cnContentCard({ view: view, isInverted: isInverted, pictureAtBottom: pictureAtBottom }) }, otherProps),
        lineColor && (React.createElement("div", { className: cnContentCard('Line'), style: { backgroundColor: lineColor } })),
        photo && React.createElement(Picture, __assign({}, photo, { className: cnContentCard('Photo') })),
        picture && React.createElement(Picture, __assign({}, picture, { className: cnContentCard('Photo') })),
        title && (React.createElement(Typography.Title, { size: titleSize !== null && titleSize !== void 0 ? titleSize : getSizeByMap(sizeMap, view), className: cnContentCard('Title'), as: titleTag }, title)),
        text && React.createElement(Article, { className: cnContentCard('Text'), content: text }),
        link && view === 'default' && (React.createElement("div", { className: cnContentCard('Button') },
            React.createElement(Button, { view: "link-primary", isLink: true, label: linkTitle, to: link, iconRight: IconArrowRight, decorBorder: color === null || color === void 0 ? void 0 : color.replace('#', '') })))));
});
