@uppy/dashboard
Version:
Universal UI plugin for Uppy.
39 lines • 854 B
JavaScript
import { h } from 'preact';
import getFileTypeIcon from "../utils/getFileTypeIcon.js";
export default function FilePreview(props) {
const {
file
} = props;
if (file.preview) {
return h("img", {
className: "uppy-Dashboard-Item-previewImg",
alt: file.name,
src: file.preview
});
}
const {
color,
icon
} = getFileTypeIcon(file.type);
return h("div", {
className: "uppy-Dashboard-Item-previewIconWrap"
}, h("span", {
className: "uppy-Dashboard-Item-previewIcon",
style: {
color
}
}, icon), h("svg", {
"aria-hidden": "true",
focusable: "false",
className: "uppy-Dashboard-Item-previewIconBg",
width: "58",
height: "76",
viewBox: "0 0 58 76"
}, h("rect", {
fill: "#FFF",
width: "58",
height: "76",
rx: "3",
fillRule: "evenodd"
})));
}