// @ts-nocheck
import './TwitterCard.css';
import React from 'react';
import { IconArrowRight } from '../../icons/IconArrowRight/IconArrowRight';
import { IconTwitter } from '../../icons/IconTwitter/IconTwitter';
import { IconYouTube } from '../../icons/IconYouTube/IconYouTube';
import { cn } from '../../utils/bem';
import { forwardRefWithAs } from '../../utils/types/PropsWithAsAttributes';
import { Button } from '../Button/Button';
import { usePropsHandler } from '../EventInterceptor/usePropsHandler';
import { Typography } from '../Typography/Typography';
import { User } from '../User/User';
export var cnTwitterCard = cn('TwitterCard');
export var TwitterCard = forwardRefWithAs(function (props, ref) {
    var _a = usePropsHandler(cnTwitterCard(), props), firstName = _a.firstName, lastName = _a.lastName, photo = _a.photo, text = _a.text, linkTitle = _a.linkTitle, type = _a.type, linkUrl = _a.linkUrl, targetBlank = _a.targetBlank;
    var buttonIcon;
    if (type === 'twitter') {
        buttonIcon = IconTwitter;
    }
    if (type === 'blog') {
        buttonIcon = IconArrowRight;
    }
    if (type === 'youtube') {
        buttonIcon = IconYouTube;
    }
    return (React.createElement(React.Fragment, null,
        React.createElement("div", { className: cnTwitterCard() },
            React.createElement(User, { size: "s", className: cnTwitterCard('User'), name: "".concat(firstName, " ").concat(lastName), avatarUrl: photo === null || photo === void 0 ? void 0 : photo.desktop2x }),
            React.createElement(Typography.Text, { className: cnTwitterCard('Text') }, text),
            React.createElement("div", { className: cnTwitterCard('Bottom') },
                React.createElement(Button, { view: "link-secondary", as: "a", href: linkUrl, iconSize: 's', label: linkTitle, iconRight: buttonIcon, target: targetBlank ? '_blank' : null })))));
});
