@anoki/fse-ui
Version:
FSE UI components library
3 lines (2 loc) • 2.46 kB
JavaScript
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./components/ui/CardFile/CardFile.css');const e=require("./index.cjs237.js"),l=require("./index.cjs239.js"),c=require("./index.cjs292.js"),u=require("./index.cjs25.js"),j=require("./index.cjs32.js");;/* empty css */const m=require("./index.cjs199.js"),h=require("./index.cjs143.js"),E=require("./index.cjs189.js"),R=require("./index.cjs105.js"),w=require("./index.cjs197.js");var d=(r=>(r.DOWNLOAD="download",r.GOTO="goto",r.EXTERNAL="external",r))(d||{});function y({title:r,description:n,issued_at:i,file:t,action:s,asLink:x="a"}){const a=async()=>{try{const p=await(await fetch(s.link.link)).blob();c.FileSaver_minExports.saveAs(p,r)}catch(o){console.error("Error downloading file:",o)}};return e.jsxRuntimeExports.jsxs("div",{className:"card-file shadow rounded h-100 w-100 bg-white",children:[e.jsxRuntimeExports.jsxs("div",{className:l.clsx("top-container pt-x16 pb-x12",{"px-x16":s.type==="download","px-x24 ":s.type!=="download"}),children:[s.type==="download"&&e.jsxRuntimeExports.jsx("div",{className:"icon-wrapper",children:e.jsxRuntimeExports.jsx(m.File,{height:27,width:27})}),e.jsxRuntimeExports.jsxs("div",{className:"content-container",children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("h1",{className:"card-file-title text-slate-20 mt-x8",children:r}),t&&(t.type||t.size)&&e.jsxRuntimeExports.jsx("p",{className:"file-type text-muted",children:t.type&&t.size?`${t.type} | ${t.size}`:t.type||t.size})]}),n&&e.jsxRuntimeExports.jsx("div",{className:"description text-slate-28",children:e.jsxRuntimeExports.jsx(h.RichText,{description:n})}),i&&e.jsxRuntimeExports.jsx("p",{className:"description text-slate-28",children:i})]})]}),e.jsxRuntimeExports.jsx("div",{className:l.clsx("card-file-footer px-x24",s.type,{"pt-x4 pb-x16":s.type==="external","py-x16 ":s.type!=="external"}),children:s.type==="download"?e.jsxRuntimeExports.jsxs(j.Button,{className:"bg-transparent download-button",onClick:a,children:[e.jsxRuntimeExports.jsx(E.Download,{}),s.link.title]}):s.type==="goto"?e.jsxRuntimeExports.jsx(u.ArrowLink,{href:s.link.link,asLink:x,children:s.link.title}):e.jsxRuntimeExports.jsx(R.Link,{title:s.link.title,src:s.link.link,icon:w.ExternalLink,decoration:"ui-footer-logo-link",transform:"none",external:!0,asLink:x})})]})}exports.CardFile=y;exports.CardFileActionTypeEnum=d;
//# sourceMappingURL=index.cjs44.js.map