// @ts-nocheck
import './ExternalCard.css';
import React from 'react';
import { IconOpenInNew } from '../../icons/IconOpenInNew/IconOpenInNew';
import { cn } from '../../utils/bem';
import { getSizeByMap } from '../../utils/getSizeByMap';
import { Button } from '../Button/Button';
import { Typography } from '../Typography';
import { User } from '../User/User';
export var cardPropSize = ['m'];
export var cardPropSizeDefault = cardPropSize[0];
export var cardPropView = ['default', 'text'];
export var cardPropViewDefault = cardPropView[0];
var sizeMapTitle = {
    m: 'md'
};
export var cnExternalCard = cn('ExternalCard');
export var ExternalCard = 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, text = props.text, link = props.link, linkText = props.linkText, onClickButton = props.onClickButton, authorName = props.authorName, authorPosition = props.authorPosition, authorPhoto = props.authorPhoto, members = props.members, title = props.title;
    return (React.createElement("div", { className: cnExternalCard({ size: size, view: view }, [className]) },
        React.createElement("div", { className: cnExternalCard('Body') },
            React.createElement(Typography.Title, { size: getSizeByMap(sizeMapTitle, size), className: cnExternalCard('Title') }, text !== null && text !== void 0 ? text : title),
            link && (React.createElement("div", { className: cnExternalCard('Button') }, Object.keys(link).length > 0 && typeof link !== 'string' ? (React.createElement(Button, { view: "link-secondary", as: "a", label: link.title, href: link.link, iconRight: IconOpenInNew, onClick: onClickButton, iconSize: "xs", target: link.targetBlank ? '_blank' : null })) : (React.createElement(Button, { view: "link-secondary", as: "a", label: linkText, href: link, iconRight: IconOpenInNew, onClick: onClickButton, iconSize: "xs", target: link.targetBlank ? '_blank' : null }))))),
        React.createElement("div", { className: cnExternalCard('User') }, members ? (React.createElement(React.Fragment, null, members.map(function (author) {
            var _a;
            return (React.createElement(User, { size: "xs", avatarUrl: (_a = author.photo) === null || _a === void 0 ? void 0 : _a.desktop2x, key: "".concat(author.firstName, " ").concat(author.lastName), name: "".concat(author.firstName, " ").concat(author.lastName), info: author.title }));
        }))) : (React.createElement(User, { size: "xs", name: authorName, info: authorPosition, avatarUrl: authorPhoto === null || authorPhoto === void 0 ? void 0 : authorPhoto.url })))));
});
