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.

25 lines (24 loc) 1.79 kB
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; var ArticleHorizontalItemCard = function (_a) { var article = _a.article, setActiveMarker = _a.setActiveMarker, customArticleRenderer = _a.customArticleRenderer; var renderData = function () { if (customArticleRenderer) { return _jsx(_Fragment, { children: customArticleRenderer(article) }); } return (_jsxs("div", { children: [_jsx("h2", { className: "articleTitle text-2xl font-semibold text-gray-900", children: article.name }), _jsx("p", { className: "text-gray-600 mt-2", children: article.description }), _jsxs("p", { className: "text-sm text-gray-500 block mt-1", children: ["Lat: ", article.latitude, ", Long: ", article.longitude] }), _jsx("a", { href: article === null || article === void 0 ? void 0 : article.url, className: "mt-4 block w-fit bg-blue-500 text-white py-2 px-4 rounded-xl hover:bg-blue-600", children: "Learn More" })] })); }; return (_jsx("div", { id: "google_map_store_".concat(article === null || article === void 0 ? void 0 : article.id), onClick: function (e) { e.preventDefault(); var element = document.getElementById("google-map"); if (element) { window.scrollTo({ top: element.offsetTop, behavior: "smooth", }); // eslint-disable-next-line @typescript-eslint/no-explicit-any if (setActiveMarker) setActiveMarker(article); } }, className: "articleBox bg-gray-100 mb-[30px] rounded-2xl shadow-lg p-6 hover:scale-105 transition-transform duration-300", children: renderData() }, article.id)); }; export default ArticleHorizontalItemCard;