@anoki/fse-marche-ui
Version:
FSE UI components library
65 lines (64 loc) • 2.03 kB
JavaScript
import { j as e } from "./index.es137.js";
import './components/ui/CardMapStructure/CardMap.css';/* empty css */
import { useState as v, useRef as w, useEffect as g } from "react";
import { Col as o } from "./index.es10.js";
const E = ({
id: c,
title: l,
titleTag: d = "h3",
href: m,
description: f,
isExternal: i = !1,
asLink: u = "a",
className: p,
address: s,
setSelectedCard: x = () => {
}
}) => {
const h = u, [t, a] = v(!1), r = w(null);
return g(() => {
const n = (j) => {
r.current && !r.current.contains(j.target) && a(!1);
};
return t ? document.addEventListener("mousedown", n) : document.removeEventListener("mousedown", n), () => {
document.removeEventListener("mousedown", n);
};
}, [t]), /* @__PURE__ */ e.jsxs(
o,
{
as: "div",
justifyContent: "center",
ref: r,
br: "x4",
p: "x24",
bg: "white",
className: `${p} ${t ? "ui-is-active" : "ui-card-search"} shadow cursor-pointer text-slate-28`,
onClick: () => {
a(!0), x(c);
},
children: [
/* @__PURE__ */ e.jsxs(o, { pb: "x24", children: [
/* @__PURE__ */ e.jsx(d, { className: "flex-1", children: /* @__PURE__ */ e.jsx(
h,
{
className: "text-decoration-none fs-4 text-primary fw-semibold",
href: m,
target: i ? "_blank" : void 0,
rel: i ? "noreferrer noopener" : void 0,
children: l
}
) }),
/* @__PURE__ */ e.jsx("p", { className: "fs-6 fw-regular", children: f })
] }),
s && s.streetName && /* @__PURE__ */ e.jsxs(o, { as: "footer", gap: "x8", bg: "white", children: [
/* @__PURE__ */ e.jsx("h5", { className: "fw-semibold fs-6", children: "Indirizzo" }),
/* @__PURE__ */ e.jsx("p", { className: "fw-regular", children: s.plainAddress })
] })
]
}
);
};
export {
E as CardMap
};
//# sourceMappingURL=index.es27.js.map