"use strict";
exports.__esModule = true;
exports.ContentBuilderTemplate = void 0;
var tslib_1 = require("tslib");
// @ts-nocheck
require("./ContentBuilderTemplate.css");
var react_1 = (0, tslib_1.__importDefault)(require("react"));
var PropsWithAsAttributes_1 = require("../../../utils/types/PropsWithAsAttributes");
var usePropsHandler_1 = require("../../EventInterceptor/usePropsHandler");
var index_1 = require("./index");
var Typography_1 = require("../../Typography/Typography");
var Article_1 = require("../../Article/Article");
var Slider_1 = require("../../Slider/Slider");
var CaseCard_1 = require("../../CaseCard/CaseCard");
var Button_1 = require("../../Button/Button");
var react_router_dom_1 = require("react-router-dom");
var IconSoon_1 = require("../../../icons/IconSoon/IconSoon");
var IconArrowRight_1 = require("../../../icons/IconArrowRight/IconArrowRight");
exports.ContentBuilderTemplate = (0, PropsWithAsAttributes_1.forwardRefWithAs)(function (props, ref) {
    var _a = (0, usePropsHandler_1.usePropsHandler)((0, index_1.cnContentBuilderTemplate)(), props), type = _a.type, title = _a.title, text = _a.text, cases = _a.cases, aliases = _a.aliases, links = _a.links;
    var typeNumber = type.toString();
    var sliderConfig = {
        watchOverflow: true,
        navigation: true,
        slidesPerView: 'auto',
        spaceBetween: 8,
        breakpoints: {
            767: {
                spaceBetween: 16
            },
            1200: {
                spaceBetween: 24
            }
        }
    };
    return (react_1["default"].createElement("div", { className: (0, index_1.cnContentBuilderTemplate)({ type: typeNumber }) },
        title && (react_1["default"].createElement(Typography_1.Typography.Text, { size: "xs", weight: "bold", transform: "uppercase", className: (0, index_1.cnContentBuilderTemplate)('Title'), as: "h4" }, title)),
        text && (react_1["default"].createElement(Article_1.Article, { content: text, className: (0, index_1.cnContentBuilderTemplate)('SubTitle') })),
        (cases === null || cases === void 0 ? void 0 : cases.length) > 0 && (react_1["default"].createElement(Slider_1.Slider, (0, tslib_1.__assign)({}, sliderConfig), cases.map(function (item) { return (react_1["default"].createElement(Slider_1.SliderItem, { key: item.id },
            react_1["default"].createElement(CaseCard_1.CaseCard, (0, tslib_1.__assign)({}, item, { buttonTitle: "case study", routePath: (0, react_router_dom_1.generatePath)(aliases.CASE_PAGE, {
                    slug: item.slug
                }) })))); }))),
        (links === null || links === void 0 ? void 0 : links.length) > 0 && (react_1["default"].createElement("div", { className: (0, index_1.cnContentBuilderTemplate)('Links') },
            react_1["default"].createElement("div", null, links.map(function (item) { return (react_1["default"].createElement(Button_1.Button, { key: item.id, view: "link-primary", iconRight: item.path ? IconArrowRight_1.IconArrowRight : IconSoon_1.IconSoon, isLink: !!item.path, disabled: !item.path, to: item.path ? item.path : null, label: item.title })); }))))));
});
exports["default"] = exports.ContentBuilderTemplate;
