import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
+import { LoadingBar } from 'react-redux-loading-bar';
import ZoomableImage from './zoomable_image';
export default class ImageLoader extends React.PureComponent {
state = {
loading: true,
error: false,
+ width: null,
}
removers = [];
setCanvasRef = c => {
this.canvas = c;
+ if (c) this.setState({ width: c.offsetWidth });
}
render () {
return (
<div className={className}>
+ <LoadingBar loading={loading ? 1 : 0} className='loading-bar' style={{ width: this.state.width || width }} />
{loading ? (
<canvas
className='image-loader__preview-canvas'
display: flex;
align-items: center;
justify-content: center;
+ flex-direction: column;
.image-loader__preview-canvas {
max-width: $media-modal-media-max-width;
object-fit: contain;
}
- &.image-loader--loading .image-loader__preview-canvas {
- filter: blur(2px);
+ .loading-bar {
+ position: relative;
}
&.image-loader--amorphous .image-loader__preview-canvas {