"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 useStyles = theme_1.makeStyles()(function (theme, _a) {
    var badgeBackgroundColor = _a.badgeBackgroundColor, badgeColor = _a.badgeColor;
    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 theme.spacing(spacing) + "px"; })
                .join(" "),
        },
        "footerH5": {
            "marginBottom": theme.spacing(1),
        },
        "footerH6": {
            "marginBottom": theme.spacing(1),
        },
        "header": {
            "position": "relative",
            "flex": 1,
            "width": "100%",
            "margin": 0,
        },
        "projectImage": {
            "width": "100%",
            "minHeight": "100%",
            "objectFit": "cover",
        },
        "badge": {
            "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 badgeColor + " !important";
                }
                return undefined;
            })(),
        },
    });
});
exports.GlProjectCard = react_1.memo(function (props) {
    var className = props.className, date = props.date, 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,
    }), classes = _a.classes, cx = _a.cx;
    return (jsx_runtime_1.jsxs(GlCard_1.GlCard, __assign({ link: link, className: cx(classes.root, className) }, { children: [jsx_runtime_1.jsxs("div", __assign({ className: classes.header }, { children: [jsx_runtime_1.jsx("img", { className: classes.projectImage, src: projectImageUrl, alt: "project image" }, void 0),
                    badgeLabel !== undefined && (jsx_runtime_1.jsx(GlButton_1.GlButton, __assign({ type: "submit", className: classes.badge, variant: "ternary", href: link === null || link === void 0 ? void 0 : link.href, onClick: link === null || link === void 0 ? void 0 : link.onClick }, { children: badgeLabel }), void 0))] }), void 0),
            jsx_runtime_1.jsxs("div", __assign({ className: classes.footer }, { children: [jsx_runtime_1.jsx(theme_1.Text, __assign({ typo: "object heading", className: classes.footerH5 }, { children: title }), void 0),
                    jsx_runtime_1.jsx(theme_1.Text, __assign({ typo: "label 2", className: classes.footerH6 }, { children: subtitle }), void 0),
                    date !== undefined && jsx_runtime_1.jsx(theme_1.Text, __assign({ typo: "label 2" }, { children: date }), void 0)] }), void 0)] }), void 0));
});
//# sourceMappingURL=GlProjectCard.js.map