@anoki/fse-ui
Version:
FSE UI components library
156 lines (155 loc) • 6.25 kB
JavaScript
import { j as i } from "./index.es237.js";
import { useCopyToClipboardCurrentPage as L } from "./index.es309.js";
import { fromISODateToDateFormatted as U } from "./index.es308.js";
import { getFullNameInitials as $ } from "./index.es310.js";
import { splitInTwo as E } from "./index.es256.js";
import { clsx as o } from "./index.es238.js";
import { useMemo as t } from "react";
import { ActionIconText as S } from "./index.es18.js";
import { AuthorBlock as F } from "./index.es26.js";
import { Row as M } from "./index.es116.js";
import './components/ui/HeroContentCard/HeroContentCard.css';/* empty css */
import { ShareButton as R } from "./index.es125.js";
import { CopyLink as H } from "./index.es181.js";
import { Col as O } from "./index.es61.js";
import { CardCategory as V } from "./index.es36.js";
import { Tags as q } from "./index.es147.js";
const oe = ({
data: e = {},
ImageComponent: g = "img",
imageProps: f = {},
variant: m = "service",
publishedLabel: T = "Pubblicato",
readingTimeLabel: j = "Tempo di lettura",
readingMinuteLabel: w = "min",
tagsLabelTitle: C = "Argomenti trattati",
shareLabel: I = "Condividi",
copyLinkLabel: N = "Copia link",
copiedTextLabel: y = "Link copiato",
isPreview: s = !1,
modeAuthenticated: l = !1,
eventCardDescriptionTitle: b,
tags: n
}) => {
var u, v, h;
const { copyToClipboard: B, isCopied: a } = L(), d = t(() => e != null && e.updatedBy ? $(
e.updatedBy.name ?? "",
e.updatedBy.surname ?? ""
) : "-", [e.updatedBy]), [k, c] = t(() => !e.previewImageTitle || e.previewImageTitle.trim() === "" ? [null, null] : e.previewImageTitle.trim().split(/\s+/).length >= 4 ? E(e.previewImageTitle.toUpperCase()) : [e.previewImageTitle.toUpperCase(), null], [e.previewImageTitle]), A = t(() => {
const r = e.readingTime ?? 0;
return Math.ceil(Number(r) / 60) || 0;
}, [e]), D = () => {
if (!e.previewImageUrl) return null;
if (m === "event") {
const r = (x) => "eventCardTitle" in x || "eventTitle" in x;
return /* @__PURE__ */ i.jsxs(
"div",
{
className: o(
m === "event" && "is-event",
s ? "hero-event-preview" : "hero-event-container",
l ? "margin-authenticated ratio-authenticated" : ""
),
children: [
/* @__PURE__ */ i.jsx(
"img",
{
className: "hero-event-background",
src: e.previewImageUrl,
alt: `Evento ${e.name}`
}
),
/* @__PURE__ */ i.jsxs("div", { className: "hero-event-content", children: [
/* @__PURE__ */ i.jsx(
"img",
{
className: "hero-event-main-image",
src: e.previewImageUrl,
alt: `Evento ${e.name}`
}
),
/* @__PURE__ */ i.jsxs(
O,
{
justifyContent: "space-between",
className: "hero-event-card-container",
children: [
/* @__PURE__ */ i.jsx("div", { children: r(e) && (e.eventCardTitle || e.eventCardDescription) && /* @__PURE__ */ i.jsx(
V,
{
title: r(e) ? e.eventCardTitle ?? "-" : "-",
className: "w-full",
description: r(e) ? b ?? "-" : "-",
description2: r(e) ? e.eventCardDescription ?? "-" : "-",
classNameTitle: "text-slate-20 fs-5 md-fs-custom-2",
classNameDescriptionTitle: "text-slate-28 fw-bold fs-6 md-fs-custom"
}
) }),
n && (n == null ? void 0 : n.length) > 0 && /* @__PURE__ */ i.jsx(q, { title: C, items: n ?? [] })
]
}
)
] })
]
}
);
}
return /* @__PURE__ */ i.jsxs(
"div",
{
className: o(
s ? "hero-service-detail-image" : "hero-fullscreen-image-container",
l ? "margin-authenticated" : ""
),
children: [
/* @__PURE__ */ i.jsx(
g,
{
alt: `Service ${e.name} image`,
src: e.previewImageUrl,
style: { aspectRatio: 21 / 9 },
...f
}
),
(e == null ? void 0 : e.previewImageTitle) && (e == null ? void 0 : e.previewImageTitle.trim()) !== "" && /* @__PURE__ */ i.jsxs("p", { className: o("short-title", e != null && e.previewImageTextAlign ? e == null ? void 0 : e.previewImageTextAlign : ""), children: [
/* @__PURE__ */ i.jsx("span", { children: k }),
c && /* @__PURE__ */ i.jsx("span", { children: c })
] })
]
}
);
}, p = /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
/* @__PURE__ */ i.jsxs("div", { className: "hero-action-author", children: [
/* @__PURE__ */ i.jsx(
F,
{
authorName: (u = e == null ? void 0 : e.updatedBy) != null && u.name ? `${(v = e == null ? void 0 : e.updatedBy) == null ? void 0 : v.name} ${(h = e == null ? void 0 : e.updatedBy) == null ? void 0 : h.surname}` : "-",
avatar: { initials: d },
publishedLabel: T,
publishedDate: U(e.updatedAt ?? "", "it") ?? "-",
readingTimeLabel: j,
readingTimeValue: A,
readingMinuteLabel: w
}
),
/* @__PURE__ */ i.jsxs(M, { gap: "x8", className: "hero-action-link", children: [
/* @__PURE__ */ i.jsx(R, { textLabel: I, titleShared: e.name }),
/* @__PURE__ */ i.jsx("div", { className: "share-divider", children: /* @__PURE__ */ i.jsx(
S,
{
textLabel: a ? y : N,
icon: /* @__PURE__ */ i.jsx(H, {}),
handleAction: B,
classNameText: "fw-bold"
}
) })
] })
] }),
D()
] });
return s ? /* @__PURE__ */ i.jsx("div", { className: "hero-content-card-container-preview", children: p }) : p;
};
export {
oe as HeroContentCard
};
//# sourceMappingURL=index.es99.js.map