"use strict";
exports.__esModule = true;
exports.ProjectCard = exports.projectCardPropViewDefault = exports.projectCardPropView = void 0;
var tslib_1 = require("tslib");
/* eslint-disable jsx-a11y/control-has-associated-label */
// @ts-nocheck
/* eslint-disable jsx-a11y/anchor-has-content */
/* eslint-disable jsx-a11y/img-redundant-alt */
require("./ProjectCard.css");
var react_1 = (0, tslib_1.__importStar)(require("react"));
var IconOpenInNew_1 = require("../../icons/IconOpenInNew/IconOpenInNew");
var bem_1 = require("../../utils/bem");
var PropsWithAsAttributes_1 = require("../../utils/types/PropsWithAsAttributes");
var Button_1 = require("../Button/Button");
var Picture_1 = require("../Picture/Picture");
var Typography_1 = require("../Typography");
exports.projectCardPropView = ['default'];
exports.projectCardPropViewDefault = exports.projectCardPropView[0];
var cnProjectCard = (0, bem_1.cn)('ProjectCard');
exports.ProjectCard = (0, PropsWithAsAttributes_1.forwardRefWithAs)(function (props) {
    var _a = props.view, view = _a === void 0 ? exports.projectCardPropViewDefault : _a, title = props.title, link = props.link, picture = props.picture, additionalLinks = props.additionalLinks;
    var LinkImageComponent = (0, react_1.useMemo)(function () { var _a; return react_1["default"].createElement(react_1["default"].Fragment, null, (link === null || link === void 0 ? void 0 : link.icon) && react_1["default"].createElement("img", { src: (_a = link === null || link === void 0 ? void 0 : link.icon) === null || _a === void 0 ? void 0 : _a.url, alt: "photo" })); }, [link === null || link === void 0 ? void 0 : link.icon]);
    return (react_1["default"].createElement("div", { className: cnProjectCard({ view: view }) },
        react_1["default"].createElement("a", { className: cnProjectCard('OverlayLink'), target: link.targetBlank ? '_blank' : null, href: link.link, rel: link.targetBlank ? 'noreferrer noopener' : null }),
        picture && (react_1["default"].createElement("div", { className: cnProjectCard('Picture') },
            react_1["default"].createElement(Picture_1.Picture, { desktop: picture.url, desktopWebp: picture.urlWebp }))),
        react_1["default"].createElement("div", { className: cnProjectCard('Inner') },
            react_1["default"].createElement(Typography_1.Typography.Text, { className: cnProjectCard('Title') }, title),
            (additionalLinks === null || additionalLinks === void 0 ? void 0 : additionalLinks.length) > 0 && (react_1["default"].createElement("div", { className: cnProjectCard('Links') }, additionalLinks.map(function (additionalLink) { return (react_1["default"].createElement("div", { className: cnProjectCard('Links-Item') },
                react_1["default"].createElement(Button_1.Button, { label: additionalLink.title, as: "a", target: additionalLink.targetBlank ? '_blank' : null, href: additionalLink.link, view: "link-secondary", badge: {
                        text: additionalLink.labelText,
                        inverted: additionalLink.labelInverted,
                        color: additionalLink.labelColor
                    } }))); }))),
            link && (react_1["default"].createElement("div", { className: cnProjectCard('Button') },
                react_1["default"].createElement(Button_1.Button, { label: link === null || link === void 0 ? void 0 : link.title, view: "link-secondary", icon: !!(link === null || link === void 0 ? void 0 : link.icon) && LinkImageComponent, iconRight: !(link === null || link === void 0 ? void 0 : link.icon) && IconOpenInNew_1.IconOpenInNew, iconSize: "xs", target: link.targetBlank ? '_blank' : null, as: "a", href: link.link }))))));
});
