UNPKG

@anoki/fse-ui

Version:

FSE UI components library

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