Fix #414 - Improve lightbox, add loading indicator

This commit is contained in:
Eugen Rochko 2017-01-16 12:04:02 +01:00
parent a78148f763
commit da5d366230
4 changed files with 35 additions and 127 deletions

View file

@ -1,6 +1,8 @@
import { connect } from 'react-redux';
import { closeModal } from '../../../actions/modal';
import Lightbox from '../../../components/lightbox';
import { connect } from 'react-redux';
import { closeModal } from '../../../actions/modal';
import Lightbox from '../../../components/lightbox';
import ImageLoader from 'react-imageloader';
import LoadingIndicator from '../../../components/loading_indicator';
const mapStateToProps = state => ({
url: state.getIn(['modal', 'url']),
@ -23,6 +25,8 @@ const imageStyle = {
maxHeight: '80vh'
};
const preloader = () => <LoadingIndicator />;
const Modal = React.createClass({
propTypes: {
@ -37,7 +41,11 @@ const Modal = React.createClass({
return (
<Lightbox {...other}>
<img src={url} style={imageStyle} />
<ImageLoader
src={url}
preloader={preloader}
imgProps={{ style: imageStyle }}
/>
</Lightbox>
);
}