import e from"@babel/runtime/helpers/defineProperty";import i from"prop-types";import r from"classnames";import{withStyles as t,Typography as l}from"@material-ui/core";import o from"@material-ui/icons/Delete";import a from"@material-ui/core/colors/grey";import s from"./styles.css.js";import n from"../../utils/main.js";import{getIsImage as m}from"../../utils/fileExtension.js";import c from"../FileTypeIcon.js";import p from"../IconButton/index.js";import{jsxs as d,jsx as f}from"react/jsx-runtime";var u=function(i){var t=i.fileName,u=i.fileUrl,v=i.handleFileDelete,F=i.classes,w=m(t);return d("div",{className:r(s.cComponentFilePreview,F.wrapper),children:[f("div",w?{className:s.cComponentFilePreviewImageFileWrapper,children:f("img",{"data-testid":"".concat("filePreview","_filePreview"),className:s.cComponentFilePreviewImage,src:u,alt:"Uploaded file"})}:{className:s.cComponentFilePreviewWrapper,children:d("div",{className:s.cComponentFilePreviewDownload,style:{border:"1px solid ".concat(a[400])},children:[f(c,{fileName:t,size:25}),f("div",{className:s.cComponentFilePreviewDownloadText,children:f(l,{"data-testid":"".concat("filePreview","_fileName"),variant:"subtitle2",noWrap:!0,children:n.getFileNameWithExtensionFromPath(t)})})]})}),f(p,{title:"Delete",onClick:v,className:r(s.cComponentFilePreviewDeleteFile,e({},s.cComponentFilePreviewDeleteFileCentered,!w)),tooltipProps:{title:"Delete"},children:f(o,{"data-testid":"".concat("filePreview","_deleteButton")})})]})};u.propTypes={fileName:i.string.isRequired,fileUrl:i.string.isRequired,handleFileDelete:i.func.isRequired,classes:i.shape({deleteTooltip:i.string.isRequired}).isRequired};var v=t({deleteTooltip:{marginTop:"3px",backgroundColor:"rgba(97, 97, 97, 0.4)"}})(u);export{v as default};
