"use strict";
var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.GlProjectCard = void 0;
var jsx_runtime_1 = require("react/jsx-runtime");
/* eslint-disable @typescript-eslint/no-namespace */
var react_1 = require("react");
var GlButton_1 = require("../utils/GlButton");
var theme_1 = require("../theme");
var GlCard_1 = require("./GlCard");
var theme_2 = require("../theme");
var tss_react_1 = require("tss-react");
exports.GlProjectCard = (0, react_1.memo)(function (props) {
    var className = props.className, text = props.text, projectImageUrl = props.projectImageUrl, subtitle = props.subtitle, title = props.title, badgeLabel = props.badgeLabel, link = props.link, badgeBackgroundColor = props.badgeBackgroundColor, badgeColor = props.badgeColor;
    var _a = useStyles({
        badgeColor: badgeColor,
        badgeBackgroundColor: badgeBackgroundColor,
        projectImageUrl: projectImageUrl,
    }), classes = _a.classes, cx = _a.cx;
    classes = (0, tss_react_1.useMergedClasses)(classes, props.classes);
    return ((0, jsx_runtime_1.jsxs)(GlCard_1.GlCard, __assign({ link: link, className: cx(classes.root, className) }, { children: [(0, jsx_runtime_1.jsx)("div", __assign({ className: classes.header }, { children: badgeLabel !== undefined && ((0, jsx_runtime_1.jsx)(GlButton_1.GlButton, __assign({ type: "submit", className: classes.button, variant: "ternary", href: link === null || link === void 0 ? void 0 : link.href, onClick: link === null || link === void 0 ? void 0 : link.onClick }, { children: badgeLabel }))) })), (0, jsx_runtime_1.jsxs)("div", __assign({ className: classes.footer }, { children: [(0, jsx_runtime_1.jsx)(theme_1.Text, __assign({ typo: "object heading", className: classes.footerTitle }, { children: title })), subtitle !== undefined && ((0, jsx_runtime_1.jsx)(theme_1.Text, __assign({ typo: "label 2", className: classes.footerSubtitle }, { children: subtitle }))), text !== undefined && ((0, jsx_runtime_1.jsx)(theme_1.Text, __assign({ className: classes.footerText, typo: "label 2" }, { children: text })))] }))] })));
});
var useStyles = (0, theme_1.makeStyles)()(function (theme, _a) {
    var badgeBackgroundColor = _a.badgeBackgroundColor, badgeColor = _a.badgeColor, projectImageUrl = _a.projectImageUrl;
    return ({
        "root": {
            "display": "flex",
            "flexDirection": "column",
            "overflow": "hidden",
            "margin": (function () {
                if (theme.windowInnerWidth >= theme_2.breakpointsValues.lg) {
                    return undefined;
                }
                return theme.spacing(1);
            })(),
        },
        "footer": {
            "backgroundColor": theme.isDarkModeEnabled
                ? theme.colors.palette.dark.greyVariant1
                : theme.colors.palette.light.light,
            "padding": [4, 5, 4, 5]
                .map(function (spacing) { return "".concat(theme.spacing(spacing), "px"); })
                .join(" "),
        },
        "footerTitle": {
            "marginBottom": theme.spacing(1),
        },
        "footerSubtitle": {
            "marginBottom": theme.spacing(1),
        },
        "header": {
            "position": "relative",
            "flex": 1,
            "width": "100%",
            "margin": 0,
            "background": "url(\"".concat(projectImageUrl, "\")"),
            "backgroundSize": "cover",
            "backgroundPosition": "center",
            "height": 0,
            "paddingTop": "96%",
        },
        "button": {
            "position": "absolute",
            "top": theme.spacing(3),
            "right": theme.spacing(3),
            "border": "none",
            "backgroundColor": badgeBackgroundColor !== null && badgeBackgroundColor !== void 0 ? badgeBackgroundColor : undefined,
            "color": (function () {
                if (badgeColor !== undefined) {
                    return "".concat(badgeColor, " !important");
                }
                return undefined;
            })(),
        },
        "footerText": {},
    });
});
//# sourceMappingURL=GlProjectCard.js.map