{
- e.target.style.display = 'initial'
- imageLoaded && imageLoaded()
- }}
- />
- )
- } else {
- originalPhoto = (
-
- {({ loading, error, data }) => {
- if (error) {
- alert(error)
- return null
- }
-
- if (data && data.photo) {
- const photo = data.photo
-
- return (
- {
- e.target.style.display = 'initial'
- imageLoaded && imageLoaded()
- }}
- />
- )
- }
-
- return null
- }}
-
- )
- }
-
- setOriginalPhoto(originalPhoto)
- }
-
- const timeoutHandle = setTimeout(loadOriginalPhoto, 500)
-
- return function cleanup() {
- clearTimeout(timeoutHandle)
- }
- }, [])
-
+export const PresentPhoto = ({ photo, imageLoaded, ...otherProps }) => {
return (
- {originalPhoto}
-
+
+ {
+ e.target.style.display = 'initial'
+ imageLoaded && imageLoaded()
+ }}
+ />
)
}
PresentPhoto.propTypes = {
photo: PropTypes.object,
- thumbnail: PropTypes.string,
imageLoaded: PropTypes.func,
}