@anoki/fse-ui
Version:
FSE UI components library
73 lines (72 loc) • 2.56 kB
JavaScript
import { j as e } from "./index.es278.js";
import { useState as C, useRef as N, useEffect as k } from "react";
import './components/ui/CardMapStructure/CardMap.css';/* empty css */
import { PositionLink as L } from "./index.es212.js";
import { Col as t } from "./index.es82.js";
import { Row as I } from "./index.es219.js";
import { Tag as R } from "./index.es257.js";
const M = ({
id: m,
title: f,
titleTag: p = "h2",
href: s,
description: a,
isExternal: r = !1,
asLink: x = "a",
className: u,
plainAddress: c,
showGoToLabel: h = !1,
goToLabel: l = "Indicazioni",
setSelectedCard: j = () => {
},
addressLabel: w = "Indirizzo",
addressLabelTitleTag: g = "h3"
}) => {
const v = x, [o, d] = C(!1), i = N(null);
return k(() => {
const n = (b) => {
i.current && !i.current.contains(b.target) && d(!1);
};
return o ? document.addEventListener("mousedown", n) : document.removeEventListener("mousedown", n), () => {
document.removeEventListener("mousedown", n);
};
}, [o]), /* @__PURE__ */ e.jsxs(
t,
{
as: "div",
justifyContent: "center",
ref: i,
br: "x4",
p: "x24",
bg: "white",
className: `${u} ${o ? "ui-is-active" : "ui-card-search"} shadow cursor-pointer text-slate-28`,
onClick: () => {
d(!0), j(m);
},
children: [
/* @__PURE__ */ e.jsxs(t, { pb: "x24", children: [
/* @__PURE__ */ e.jsx(p, { className: "flex-1", children: /* @__PURE__ */ e.jsx(
v,
{
className: "text-decoration-none fs-4 text-primary fw-semibold",
href: s,
target: r ? "_blank" : void 0,
rel: r ? "noreferrer noopener" : void 0,
children: f
}
) }),
a && /* @__PURE__ */ e.jsx(I, { flexWrap: "wrap", gap: "x8", py: "x8", children: /* @__PURE__ */ e.jsx(R, { label: a, className: "ui-card-map-tag" }) })
] }),
c && /* @__PURE__ */ e.jsxs(t, { as: "footer", gap: "x8", bg: "white", children: [
/* @__PURE__ */ e.jsx(g, { className: "fw-semibold fs-6", children: w }),
/* @__PURE__ */ e.jsx("p", { className: "fw-regular", children: c })
] }),
h && l && s && /* @__PURE__ */ e.jsx(t, { as: "footer", bg: "white", alignItems: "end", pt: "x16", children: /* @__PURE__ */ e.jsx(L, { href: s, isExternal: r, iconPosition: "left", children: l.toUpperCase() }) })
]
}
);
};
export {
M as CardMap
};
//# sourceMappingURL=index.es52.js.map