import { __assign } from "tslib";
// @ts-nocheck
import './ContentBuilderTemplate.css';
import React from 'react';
import { generatePath } from 'react-router';
import { forwardRefWithAs } from '../../../utils/types/PropsWithAsAttributes';
import { usePropsHandler } from '../../EventInterceptor/usePropsHandler';
import { cnContentBuilderTemplate } from './index';
import { Slider, SliderItem } from '../../Slider/Slider';
import { Grid, GridItem } from '../../Grid/Grid';
import { Typography } from '../../Typography/Typography';
import { NewsCard } from '../../NewsCard/NewsCard';
export var ContentBuilderTemplate = forwardRefWithAs(function (props, ref) {
    var _a = usePropsHandler(cnContentBuilderTemplate(), props), type = _a.type, newsTitle = _a.newsTitle, news = _a.news, mediaTitle = _a.mediaTitle, media = _a.media, aliases = _a.aliases;
    var typeNumber = type.toString();
    return (React.createElement("div", { className: cnContentBuilderTemplate({ type: typeNumber }) },
        React.createElement(Grid, { breakpoints: {
                desktop: { cols: 12, colGap: '5xl' },
                tablet: { rowGap: 'xxl' },
                mobile: { rowGap: 'xxl' }
            } },
            (news === null || news === void 0 ? void 0 : news.length) > 0 && (React.createElement(GridItem, { breakpoints: { desktop: { col: 4, order: 2 } }, className: "News" },
                newsTitle && (React.createElement(Typography.Text, { size: "xs", weight: "bold", transform: "uppercase", className: "News-Title" }, newsTitle)),
                React.createElement("div", { className: cnContentBuilderTemplate('ListSlider') },
                    React.createElement(Slider, { navigation: true, watchOverflow: true, autoHeight: true, spaceBetween: 1000 }, news.map(function (itemsPress) { return (React.createElement(SliderItem, null,
                        React.createElement(Grid, { cols: "1", gap: "3xl" }, itemsPress.map(function (item) { return (React.createElement(GridItem, { col: "1", key: item.id },
                            React.createElement(NewsCard, __assign({}, item, { size: "s", path: item.parentSlug && item.slug
                                    ? generatePath(aliases.NEWSROOM_PAGE, {
                                        parentSlug: item.parentSlug,
                                        slug: item.slug
                                    })
                                    : null, picture: false })))); })))); }))))),
            (media === null || media === void 0 ? void 0 : media.length) > 0 && (React.createElement(GridItem, { breakpoints: { desktop: { col: 8, order: -1 } } },
                mediaTitle && (React.createElement(Typography.Text, { size: "xs", weight: "bold", transform: "uppercase" }, mediaTitle)),
                React.createElement(Slider, { navigation: true, watchOverflow: true, autoHeight: true, spaceBetween: 1000 }, media.map(function (group, index) { return (React.createElement(SliderItem, { key: index },
                    React.createElement(Grid, { cols: "1", className: cnContentBuilderTemplate('ListBorder') }, group.map(function (item) { return (React.createElement(GridItem, { col: "1", key: item.id },
                        React.createElement(NewsCard, __assign({}, item, { labelButton: 'Read more', path: item.parentSlug && item.slug
                                ? generatePath(aliases.NEWSROOM_PAGE, {
                                    parentSlug: item.parentSlug,
                                    slug: item.slug
                                })
                                : null })))); })))); })))))));
});
export default ContentBuilderTemplate;
