react-file-utils
Advanced tools
Comparing version 1.1.5 to 1.1.6
@@ -1,2 +0,2 @@ | ||
import React, { useCallback, useEffect, useState } from 'react'; | ||
import React, { useCallback } from 'react'; | ||
import { IconButton } from './IconButton'; | ||
@@ -7,19 +7,7 @@ import placeholder from '../images/placeholder-generic.png'; | ||
var id = props.id, image = props.image, _a = props.size, size = _a === void 0 ? 100 : _a, handleClose = props.handleClose; | ||
var _b = useState(null), imgSrc = _b[0], setImgSrc = _b[1]; | ||
useEffect(function () { | ||
// if upload is a base64 string set as image source, otherwise wait for CDN response | ||
if (!imgSrc && (image === null || image === void 0 ? void 0 : image.startsWith('data:'))) { | ||
setImgSrc(image); | ||
} | ||
}, [image]); | ||
var onClose = useCallback(function () { | ||
if (handleClose) { | ||
handleClose(id); | ||
} | ||
}, [id, handleClose]); | ||
var imageToPreview = (image === null || image === void 0 ? void 0 : image.includes('.HEIC')) ? image : imgSrc; | ||
var onClose = useCallback(function () { return handleClose === null || handleClose === void 0 ? void 0 : handleClose(id); }, [id, handleClose]); | ||
return (React.createElement("div", { className: "rfu-thumbnail__wrapper", style: { width: size, height: size } }, | ||
React.createElement("div", { className: "rfu-thumbnail__overlay" }, handleClose ? (React.createElement(IconButton, { onClick: onClose }, | ||
React.createElement("div", { dangerouslySetInnerHTML: { __html: svg } }))) : null), | ||
React.createElement("img", { src: imageToPreview || placeholder, className: "rfu-thumbnail__image", alt: "" }))); | ||
React.createElement("img", { src: image || placeholder, className: "rfu-thumbnail__image", alt: "" }))); | ||
}; |
@@ -544,19 +544,7 @@ 'use strict'; | ||
var id = props.id, image = props.image, _a = props.size, size = _a === void 0 ? 100 : _a, handleClose = props.handleClose; | ||
var _b = React.useState(null), imgSrc = _b[0], setImgSrc = _b[1]; | ||
React.useEffect(function () { | ||
// if upload is a base64 string set as image source, otherwise wait for CDN response | ||
if (!imgSrc && (image === null || image === void 0 ? void 0 : image.startsWith('data:'))) { | ||
setImgSrc(image); | ||
} | ||
}, [image]); | ||
var onClose = React.useCallback(function () { | ||
if (handleClose) { | ||
handleClose(id); | ||
} | ||
}, [id, handleClose]); | ||
var imageToPreview = (image === null || image === void 0 ? void 0 : image.includes('.HEIC')) ? image : imgSrc; | ||
var onClose = React.useCallback(function () { return handleClose === null || handleClose === void 0 ? void 0 : handleClose(id); }, [id, handleClose]); | ||
return (React__default.createElement("div", { className: "rfu-thumbnail__wrapper", style: { width: size, height: size } }, | ||
React__default.createElement("div", { className: "rfu-thumbnail__overlay" }, handleClose ? (React__default.createElement(IconButton, { onClick: onClose }, | ||
React__default.createElement("div", { dangerouslySetInnerHTML: { __html: svg } }))) : null), | ||
React__default.createElement("img", { src: imageToPreview || img, className: "rfu-thumbnail__image", alt: "" }))); | ||
React__default.createElement("img", { src: image || img, className: "rfu-thumbnail__image", alt: "" }))); | ||
}; | ||
@@ -563,0 +551,0 @@ |
{ | ||
"name": "react-file-utils", | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"description": "React components for managing files and images", | ||
@@ -5,0 +5,0 @@ "author": "GetStream", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
193680
1839