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