"use strict";
exports.__esModule = true;
exports.MemberCard = exports.cnMemberCard = void 0;
var tslib_1 = require("tslib");
/* eslint-disable jsx-a11y/anchor-has-content */
/* eslint-disable jsx-a11y/control-has-associated-label */
// @ts-nocheck
require("./MemberCard.css");
var react_1 = (0, tslib_1.__importDefault)(require("react"));
var react_router_dom_1 = require("react-router-dom");
var IconFacebook_1 = require("../../icons/IconFacebook/IconFacebook");
var IconLinkedin_1 = require("../../icons/IconLinkedin/IconLinkedin");
var IconMedium_1 = require("../../icons/IconMedium/IconMedium");
var IconSkype_1 = require("../../icons/IconSkype/IconSkype");
var IconTwitter_1 = require("../../icons/IconTwitter/IconTwitter");
var bem_1 = require("../../utils/bem");
var PropsWithAsAttributes_1 = require("../../utils/types/PropsWithAsAttributes");
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 User_1 = require("../User/User");
exports.cnMemberCard = (0, bem_1.cn)('MemberCard');
exports.MemberCard = (0, PropsWithAsAttributes_1.forwardRefWithAs)(function (props, ref) {
    var _a;
    var _b = (0, usePropsHandler_1.usePropsHandler)((0, exports.cnMemberCard)(), props), routePath = _b.routePath, data = (0, tslib_1.__rest)(_b, ["routePath"]);
    var slug = data.slug, photo = data.photo, firstName = data.firstName, lastName = data.lastName, title = data.title, location = data.location, position = data.position, view = data.view, size = data.size, phones = data.phones, email = data.email, skype = data.skype, contacts = data.contacts, socials = data.socials, linkedIn = data.linkedIn, twitter = data.twitter, medium = data.medium, facebook = data.facebook, isHiddenPage = data.isHiddenPage;
    if (size === 'xs') {
        return (react_1["default"].createElement(react_1["default"].Fragment, null,
            react_1["default"].createElement(User_1.User, { className: (0, exports.cnMemberCard)({ view: view, size: size }), avatarUrl: (_a = photo === null || photo === void 0 ? void 0 : photo.desktop) !== null && _a !== void 0 ? _a : photo === null || photo === void 0 ? void 0 : photo.url, info: position, name: "".concat(firstName, " ").concat(lastName), contacts: function () { return (react_1["default"].createElement(react_1["default"].Fragment, null,
                    phones.map(function (phone, index) { return (react_1["default"].createElement("div", { key: phone + index },
                        react_1["default"].createElement(Typography_1.Typography.Text, { as: "a", href: 'tel:' + phone, size: "s", key: phone }, phone))); }),
                    email && (react_1["default"].createElement("div", null,
                        react_1["default"].createElement(Typography_1.Typography.Text, { as: "a", href: 'mailto:' + email, size: "s" }, email))))); }, socials: function () { return (react_1["default"].createElement(react_1["default"].Fragment, null,
                    skype && (react_1["default"].createElement(Button_1.Button, { view: "ghost", onlyIcon: true, iconRight: IconSkype_1.IconSkype, as: "a", href: 'skype:' + skype, iconSize: "xs" })),
                    twitter && (react_1["default"].createElement(Button_1.Button, { view: "ghost", onlyIcon: true, iconRight: IconTwitter_1.IconTwitter, as: "a", href: twitter, iconSize: "xs" })),
                    facebook && (react_1["default"].createElement(Button_1.Button, { view: "ghost", onlyIcon: true, iconRight: IconFacebook_1.IconFacebook, as: "a", href: facebook, iconSize: "xs" })),
                    medium && (react_1["default"].createElement(Button_1.Button, { view: "ghost", onlyIcon: true, iconRight: IconMedium_1.IconMedium, as: "a", href: medium, iconSize: "xs" })),
                    linkedIn && (react_1["default"].createElement(Button_1.Button, { view: "ghost", onlyIcon: true, iconRight: IconLinkedin_1.IconLinkedin, as: "a", href: linkedIn, iconSize: "xs" })))); } })));
    }
    return (react_1["default"].createElement("div", { className: (0, exports.cnMemberCard)({
            view: view,
            size: size,
            clicked: !!routePath && !!slug && !isHiddenPage
        }) },
        routePath && slug && !isHiddenPage && (react_1["default"].createElement(react_router_dom_1.NavLink, { className: (0, exports.cnMemberCard)('Link'), to: (0, react_router_dom_1.generatePath)(routePath, { slug: slug }) })),
        react_1["default"].createElement("div", { className: (0, exports.cnMemberCard)('Inner') },
            position && (react_1["default"].createElement("div", { className: (0, exports.cnMemberCard)('Location') },
                react_1["default"].createElement(Typography_1.Typography.Text, { weight: "bold", size: "xs", transform: "uppercase" }, position))),
            location && (react_1["default"].createElement("div", { className: (0, exports.cnMemberCard)('Location') },
                react_1["default"].createElement(Typography_1.Typography.Text, { weight: "bold", size: "xs", transform: "uppercase" }, location))),
            photo && Object.keys(photo).length > 0 && (react_1["default"].createElement("div", { className: (0, exports.cnMemberCard)('Picture') },
                react_1["default"].createElement(Picture_1.Picture, (0, tslib_1.__assign)({}, photo)))),
            react_1["default"].createElement("div", { className: (0, exports.cnMemberCard)('Title') },
                react_1["default"].createElement(Typography_1.Typography.Text, { weight: "bold" },
                    firstName,
                    " ",
                    lastName)),
            title && (react_1["default"].createElement("div", { className: (0, exports.cnMemberCard)('SubTitle') },
                react_1["default"].createElement(Typography_1.Typography.Text, { size: "s" }, title))),
            contacts && (react_1["default"].createElement("div", { className: (0, exports.cnMemberCard)('Contacts') },
                phones.map(function (item) { return (react_1["default"].createElement(Typography_1.Typography.Text, { size: "s", as: "a", href: 'tel:' + item }, item)); }),
                email && (react_1["default"].createElement(Typography_1.Typography.Text, { size: "s", as: "a", href: 'mailto:' + email }, email)))),
            socials && (skype || linkedIn || twitter || twitter || medium) && (react_1["default"].createElement("div", { className: (0, exports.cnMemberCard)('Socials') },
                skype && (react_1["default"].createElement(Button_1.Button, { view: "ghost", onlyIcon: true, iconRight: IconSkype_1.IconSkype, as: "a", href: 'skype:' + skype, iconSize: "xs" })),
                twitter && (react_1["default"].createElement(Button_1.Button, { view: "ghost", onlyIcon: true, iconRight: IconTwitter_1.IconTwitter, as: "a", target: "_blank", href: twitter, iconSize: "xs" })),
                linkedIn && (react_1["default"].createElement(Button_1.Button, { view: "ghost", onlyIcon: true, iconRight: IconLinkedin_1.IconLinkedin, as: "a", target: "_blank", href: linkedIn, iconSize: "xs" })),
                medium && (react_1["default"].createElement(Button_1.Button, { view: "ghost", onlyIcon: true, iconRight: IconMedium_1.IconMedium, as: "a", target: "_blank", href: medium, iconSize: "xs" })),
                facebook && (react_1["default"].createElement(Button_1.Button, { view: "ghost", onlyIcon: true, iconRight: IconFacebook_1.IconFacebook, as: "a", target: "_blank", href: facebook, iconSize: "xs" })))))));
});
