@anoki/fse-ui
Version:
FSE UI components library
3 lines (2 loc) • 2.37 kB
JavaScript
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./components/ui/CardFile/CardFile.css');const e=require("./index.cjs244.js");;/* empty css */const c=require("./index.cjs28.js"),u=require("./index.cjs42.js"),l=require("./index.cjs246.js"),j=require("./index.cjs402.js"),m=require("./index.cjs186.js"),h=require("./index.cjs191.js"),E=require("./index.cjs99.js"),w=require("./index.cjs159.js");var d=(r=>(r.DOWNLOAD="download",r.GOTO="goto",r.EXTERNAL="external",r))(d||{});function y({title:r,description:n,issued_at:x,file:t,action:s,asLink:i="a"}){const a=async()=>{try{const p=await(await fetch(s.link.link)).blob();j.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("h4",{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("p",{className:"description text-slate-28",children:n}),x&&e.jsxRuntimeExports.jsx("p",{className:"description text-slate-28",children:x})]})]}),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(c.Button,{className:"bg-transparent download-button",onClick:a,children:[e.jsxRuntimeExports.jsx(h.Download,{}),s.link.title]}):s.type==="goto"?e.jsxRuntimeExports.jsx(u.ArrowLink,{href:s.link.link,asLink:i,children:s.link.title}):e.jsxRuntimeExports.jsx(E.Link,{title:"",src:s.link.link,icon:w.ExternalLink,decoration:"ui-footer-logo-link",transform:"none",external:!0,asLink:i})})]})}exports.CardFile=y;exports.CardFileActionTypeEnum=d;
//# sourceMappingURL=index.cjs101.js.map