UNPKG

sitecore-search-with-google-map

Version:

A library for seamless integration of Sitecore Search with Google Maps in Next.js applications, enabling location-based searches with flexible UI options.

16 lines (15 loc) 3.31 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; // This component was generated by @sitecore-search/cli on Sat Mar 08 2025 15:39:57 GMT+0530 (India Standard Time) import { CheckIcon } from '@radix-ui/react-icons'; import { useSearchResultsActions } from '@sitecore-search/react'; import { AccordionFacets, FacetItem, RangeFacet, SearchResultsAccordionFacets, SearchResultsFacetValueRange, } from '@sitecore-search/ui'; var PriceFacet = function (_a) { var min = _a.min, max = _a.max; return (_jsxs(SearchResultsFacetValueRange, { max: max, min: min, autoAdjustValues: false, className: "relative flex items-center select-none touch-none w-full h-5 mb-8", children: [_jsx(RangeFacet.Track, { className: "relative grow h-[3px] rounded-full bg-gray-400", children: _jsx(RangeFacet.Range, { className: "absolute h-full bg-gray-700 rounded-full" }) }), _jsx(RangeFacet.Start, { className: "block w-5 h-5 bg-[white] shadow-[0_2px_10px_grey] text-[10px] leading-5 text-center cursor-pointer rounded-[10px] hover:bg-gray-700 focus:shadow-[0_0_0_3px_grey]", children: function (value) { return _jsxs("span", { className: "absolute text-sm left-0 top-[30px]", children: ["$", value] }); } }), _jsx(RangeFacet.End, { className: "block w-5 h-5 bg-[white] shadow-[0_2px_10px_grey] text-[10px] leading-5 text-center cursor-pointer rounded-[10px] hover:bg-gray-700 focus:shadow-[0_0_0_3px_grey]", children: function (value) { return _jsxs("span", { className: "absolute text-sm left-0 top-[30px]", children: ["$", value] }); } })] })); }; var SearchFacets = function (_a) { var facets = _a.facets; var onFacetClick = useSearchResultsActions().onFacetClick; return (_jsx(SearchResultsAccordionFacets, { defaultFacetTypesExpandedList: [], onFacetTypesExpandedListChange: function () { }, onFacetValueClick: onFacetClick, className: "w-full", children: facets.map(function (f) { return (_jsxs(AccordionFacets.Facet, { facetId: f.name, className: "block border-b mb-4 pb-4 border-gray-200 dark:border-gray-600", children: [_jsx(AccordionFacets.Header, { className: "flex", children: _jsx(AccordionFacets.Trigger, { className: "text-sm md:text-base font-semibold focus:outline-gray-700", children: f.label }) }), _jsx(AccordionFacets.Content, { className: "mt-8", children: f.name !== 'price' ? (_jsx(AccordionFacets.ValueList, { className: "list-none mt-2 flex flex-col space-y-2", children: f.value.map(function (v, index) { return (_jsxs(FacetItem, { index: index, facetValueId: v.id, className: "group flex items-center text-sm cursor-pointer", children: [_jsx(AccordionFacets.ItemCheckbox, { className: "form-checkbox flex-none w-5 h-5 border border-gray-300 rounded cursor-pointer transition duration-500 ease-in-out hover:border-heading focus:outline-gray-700 aria-checked:bg-gray-700 aria-checked:hover:bg-heading aria-checked:focus:bg-heading", children: _jsx(AccordionFacets.ItemCheckboxIndicator, { className: "text-white w-5 h-5 ", children: _jsx(CheckIcon, {}) }) }), _jsxs(AccordionFacets.ItemLabel, { className: "text-sm ms-4 -mt-0.5", children: [v.text, " ", v.count && "(".concat(v.count, ")")] })] }, v.id)); }) })) : (_jsx(PriceFacet, { min: Math.floor(f.value[0].min), max: Math.floor(f.value[f.value.length - 1].max) })) })] }, f.name)); }) })); }; export default SearchFacets;