"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CardListingContainer = void 0;
var react_1 = __importStar(require("react"));
var _ = __importStar(require("lodash"));
var PageError_1 = require("../../PageError");
var PageListingNotFound_1 = require("../../PageListingNotFound");
var PageListingContext_1 = require("../PageListingContext");
var CardListingContainer = function FiltersComponent(props) {
    var _a = react_1.useContext(PageListingContext_1.PageListingContext), resources = _a.resources, skeletonResources = _a.skeletonResources, resourcesTotal = _a.resourcesTotal, currentPage = _a.currentPage, changePage = _a.changePage, showCardsSkeleton = _a.showCardsSkeleton, showCards = _a.showCards, errorLoadData = _a.errorLoadData, reloadPage = _a.reloadPage;
    return (react_1.default.createElement(react_1.default.Fragment, null,
        react_1.default.createElement(CardListingContainerComponent, { resources: resources, renderResource: props.renderResource, resourcesTotal: resourcesTotal, currentPage: currentPage, skeletonResources: skeletonResources, renderResourceSkeleton: props.renderResourceSkeleton, changePage: changePage, showCardsSkeleton: showCardsSkeleton, showCards: showCards, errorLoadData: errorLoadData, reloadPage: reloadPage })));
};
exports.CardListingContainer = CardListingContainer;
var CardListingContainerComponent = react_1.default.memo(function FiltersDesktop(props) {
    var showCards = props.showCards, showCardsSkeleton = props.showCardsSkeleton, errorLoadData = props.errorLoadData, resources = props.resources, renderResource = props.renderResource, resourcesTotal = props.resourcesTotal, skeletonResources = props.skeletonResources, renderResourceSkeleton = props.renderResourceSkeleton, currentPage = props.currentPage, changePage = props.changePage, reloadPage = props.reloadPage;
    return (react_1.default.createElement("div", null,
        react_1.default.createElement("div", { className: "cards-listing" },
            errorLoadData && react_1.default.createElement(PageError_1.PageError, { retry: reloadPage, fullscreen: true }),
            showCards &&
                !!resourcesTotal &&
                resources.map(function (resource, i) { return (react_1.default.createElement("span", { key: "card-" + resource.id, "data-testid": "card-" + resource.id }, renderResource(resource, i))); }),
            showCards && !resourcesTotal && react_1.default.createElement(PageListingNotFound_1.PageListingNotFound, null),
            react_1.default.createElement("div", { className: "cards-listing-skeleton" }, showCardsSkeleton &&
                skeletonResources.map(function (resource, i) { return (react_1.default.createElement("span", { key: "card-skeleton-" + i, "data-testid": "skeleton-card" }, renderResourceSkeleton(resource, i))); })))));
}, _.isEqual);
//# sourceMappingURL=CardListingContainer.js.map