@anoki/fse-ui
Version:
FSE UI components library
94 lines (93 loc) • 3.19 kB
JavaScript
import { j as e } from "./index.es244.js";
import './components/ui/CardFile/CardFile.css';/* empty css */
import { Button as x } from "./index.es28.js";
import { ArrowLink as m } from "./index.es42.js";
import { clsx as a } from "./index.es246.js";
import { F as c } from "./index.es402.js";
import { File as h } from "./index.es186.js";
import { Download as j } from "./index.es191.js";
import { Link as w } from "./index.es99.js";
import { ExternalLink as y } from "./index.es159.js";
var f = /* @__PURE__ */ ((o) => (o.DOWNLOAD = "download", o.GOTO = "goto", o.EXTERNAL = "external", o))(f || {});
function O({
title: o,
description: s,
issued_at: l,
file: t,
action: r,
asLink: n = "a"
}) {
const d = async () => {
try {
const p = await (await fetch(r.link.link)).blob();
c.saveAs(p, 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("h4", { 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("p", { className: "description text-slate-28", children: 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(
x,
{
className: "bg-transparent download-button",
onClick: d,
children: [
/* @__PURE__ */ e.jsx(j, {}),
r.link.title
]
}
) : r.type === "goto" ? /* @__PURE__ */ e.jsx(
m,
{
href: r.link.link,
asLink: n,
children: r.link.title
}
) : /* @__PURE__ */ e.jsx(
w,
{
title: "",
src: r.link.link,
icon: y,
decoration: "ui-footer-logo-link",
transform: "none",
external: !0,
asLink: n
}
)
}
)
] });
}
export {
O as CardFile,
f as CardFileActionTypeEnum
};
//# sourceMappingURL=index.es101.js.map