@anoki/fse-ui
Version:
FSE UI components library
88 lines (87 loc) • 3.22 kB
JavaScript
import { j as e } from "./index.es237.js";
import { clsx as a } from "./index.es238.js";
import { F as p } from "./index.es293.js";
import { ArrowLink as m } from "./index.es25.js";
import { Button as c } from "./index.es32.js";
import './components/ui/CardFile/CardFile.css';/* empty css */
import { File as h } from "./index.es199.js";
import { RichText as j } from "./index.es143.js";
import { Download as w } from "./index.es189.js";
import { Link as y } from "./index.es105.js";
import { ExternalLink as f } from "./index.es197.js";
var k = /* @__PURE__ */ ((o) => (o.DOWNLOAD = "download", o.GOTO = "goto", o.EXTERNAL = "external", o))(k || {});
function A({
title: o,
description: s,
issued_at: l,
file: t,
action: r,
asLink: n = "a"
}) {
const d = async () => {
try {
const x = await (await fetch(r.link.link)).blob();
p.saveAs(x, o);
} catch (i) {
console.error("Error downloading file:", i);
}
};
return /* @__PURE__ */ e.jsxs("div", { className: "card-file shadow rounded h-100 w-100 bg-white", children: [
/* @__PURE__ */ e.jsxs(
"div",
{
className: a("top-container pt-x16 pb-x12", {
"px-x16": r.type === "download",
"px-x24 ": r.type !== "download"
}),
children: [
r.type === "download" && /* @__PURE__ */ e.jsx("div", { className: "icon-wrapper", children: /* @__PURE__ */ e.jsx(h, { height: 27, width: 27 }) }),
/* @__PURE__ */ e.jsxs("div", { className: "content-container", children: [
/* @__PURE__ */ e.jsxs("div", { children: [
/* @__PURE__ */ e.jsx("h1", { className: "card-file-title text-slate-20 mt-x8", children: o }),
t && (t.type || t.size) && /* @__PURE__ */ e.jsx("p", { className: "file-type text-muted", children: t.type && t.size ? `${t.type} | ${t.size}` : t.type || t.size })
] }),
s && /* @__PURE__ */ e.jsx("div", { className: "description text-slate-28", children: /* @__PURE__ */ e.jsx(j, { description: s }) }),
l && /* @__PURE__ */ e.jsx("p", { className: "description text-slate-28", children: l })
] })
]
}
),
/* @__PURE__ */ e.jsx(
"div",
{
className: a("card-file-footer px-x24", r.type, {
"pt-x4 pb-x16": r.type === "external",
"py-x16 ": r.type !== "external"
}),
children: r.type === "download" ? /* @__PURE__ */ e.jsxs(
c,
{
className: "bg-transparent download-button",
onClick: d,
children: [
/* @__PURE__ */ e.jsx(w, {}),
r.link.title
]
}
) : r.type === "goto" ? /* @__PURE__ */ e.jsx(m, { href: r.link.link, asLink: n, children: r.link.title }) : /* @__PURE__ */ e.jsx(
y,
{
title: r.link.title,
src: r.link.link,
icon: f,
decoration: "ui-footer-logo-link",
transform: "none",
external: !0,
asLink: n
}
)
}
)
] });
}
export {
A as CardFile,
k as CardFileActionTypeEnum
};
//# sourceMappingURL=index.es44.js.map