"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SearchPage = void 0;
const react_1 = __importDefault(require("react"));
const ModalityHeader_1 = require("./ModalityHeader");
const CommunityHeader_1 = require("./CommunityHeader");
const SearchPage = ({ portalContent, renderSearchFacets, renderSearchResultsList, renderSortBy, renderFilterBlock, renderSearchHeader, renderLoading, renderAggregateCounts, }) => {
    const [isOpen, setOpen] = react_1.default.useState(false);
    return (react_1.default.createElement(react_1.default.Fragment, null,
        react_1.default.createElement("section", { className: `search search-page ${portalContent?.className || " "} ${isOpen ? " search-filters-open" : " "}` },
            portalContent
                ? (react_1.default.createElement(react_1.default.Fragment, null,
                    portalContent.portalName
                        ? (react_1.default.createElement(ModalityHeader_1.ModalityHeader, { portalName: portalContent.portalName, portalPrimary: portalContent.portalPrimary, publicDatasetStat: portalContent.publicDatasetStat, participantsStat: portalContent.participantsStat, hexBackgroundImage: portalContent.hexBackgroundImage, renderAggregateCounts: renderAggregateCounts }))
                        : null,
                    portalContent.communityHeader
                        ? (react_1.default.createElement(CommunityHeader_1.CommunityHeader, { communityHeader: portalContent.communityHeader, communityPrimary: portalContent.communityPrimary, communitySecondary: portalContent.communitySecondary }))
                        : null))
                : null,
            react_1.default.createElement("div", { className: "container" },
                react_1.default.createElement("div", { className: "grid grid-nogutter" },
                    react_1.default.createElement("div", { className: "col col-12 search-heading" },
                        react_1.default.createElement("h1", null, renderSearchHeader())),
                    react_1.default.createElement("div", { className: "col col-12 search-wrapper" },
                        react_1.default.createElement("button", { className: "show-filters-btn", onClick: () => setOpen(!isOpen) }, "Show Filters"),
                        react_1.default.createElement("div", { className: isOpen
                                ? "search-nav search-facet-wrapper show-mobile-filters"
                                : "search-nav search-facet-wrapper" },
                            react_1.default.createElement("button", { className: "close-filters-btn", onClick: () => setOpen(!isOpen) }, "Close Filters"),
                            renderSearchFacets()),
                        react_1.default.createElement("div", { className: "search-content" },
                            renderLoading(),
                            react_1.default.createElement("div", { className: "grid grid-nogutter" },
                                react_1.default.createElement("div", { className: "col col-12" }, renderFilterBlock()),
                                react_1.default.createElement("div", { className: "col col-12" },
                                    react_1.default.createElement("div", { className: "grid grid-nogutter" }, renderSortBy())),
                                renderSearchResultsList()))))))));
};
exports.SearchPage = SearchPage;
