import { __assign } from "tslib";
/* eslint-disable jsx-a11y/anchor-has-content */
/* eslint-disable jsx-a11y/control-has-associated-label */
// @ts-nocheck
import './NewsCard.css';
import React from 'react';
import { NavLink } from 'react-router-dom';
import { IconArrowRight } from '../../icons/IconArrowRight/IconArrowRight';
import { cn } from '../../utils/bem';
import { getSizeByMap } from '../../utils/getSizeByMap';
import { Article } from '../Article/Article';
import { Button } from '../Button/Button';
import { Picture } from '../Picture/Picture';
import { Typography } from '../Typography';
export var cardPropSize = ['m'];
export var cardPropSizeDefault = cardPropSize[0];
export var cardPropView = ['default', 'text'];
export var cardPropViewDefault = cardPropView[0];
var sizeMapTitle = {
    s: 'tiny',
    m: 'sm'
};
export var cnNewsCard = cn('NewsCard');
export var NewsCard = React.forwardRef(function (props, ref) {
    var className = props.className, _a = props.size, size = _a === void 0 ? cardPropSizeDefault : _a, _b = props.view, view = _b === void 0 ? 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.createElement("div", { className: cnNewsCard({ size: size, view: view }, [className]) },
        path && React.createElement(NavLink, { className: cnNewsCard('Link'), to: path }),
        picture && (React.createElement("div", { className: cnNewsCard('Picture') },
            React.createElement(Picture, __assign({}, picture)))),
        React.createElement("div", { className: cnNewsCard('Body') },
            React.createElement("div", { className: cnNewsCard('Head') },
                date && (React.createElement(Typography.Text, { size: "xs", weight: "bold", transform: "uppercase" }, date)),
                location && (React.createElement(Typography.Text, { size: "xs", weight: "bold", transform: "uppercase" }, location))),
            React.createElement(Typography.Title, { size: getSizeByMap(sizeMapTitle, size), className: cnNewsCard('Title') }, title),
            intro && React.createElement(Article, { content: intro, className: cnNewsCard('Description') }),
            path && labelButton && (React.createElement("div", { className: cnNewsCard('Button') },
                React.createElement(Button, { view: "link-secondary", label: labelButton, iconRight: IconArrowRight, isLink: !!path, to: path }))))));
});
