From da5d3662305b3d28af9e88a7168f3a1702351a9a Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Mon, 16 Jan 2017 12:04:02 +0100 Subject: Fix #414 - Improve lightbox, add loading indicator --- .../javascripts/components/components/lightbox.jsx | 22 +++++++++++----------- .../features/ui/containers/modal_container.jsx | 16 ++++++++++++---- 2 files changed, 23 insertions(+), 15 deletions(-) (limited to 'app/assets') diff --git a/app/assets/javascripts/components/components/lightbox.jsx b/app/assets/javascripts/components/components/lightbox.jsx index b5c2a69d8..1e3a88955 100644 --- a/app/assets/javascripts/components/components/lightbox.jsx +++ b/app/assets/javascripts/components/components/lightbox.jsx @@ -35,7 +35,9 @@ const Lightbox = React.createClass({ propTypes: { isVisible: React.PropTypes.bool, onOverlayClicked: React.PropTypes.func, - onCloseClicked: React.PropTypes.func + onCloseClicked: React.PropTypes.func, + intl: React.PropTypes.object.isRequired, + children: React.PropTypes.node }, mixins: [PureRenderMixin], @@ -57,19 +59,17 @@ const Lightbox = React.createClass({ render () { const { intl, isVisible, onOverlayClicked, onCloseClicked, children } = this.props; - const content = isVisible ? children :
; - return ( -
- - {({ y }) => -
+ + {({ backgroundOpacity, opacity, y }) => +
+
- {content} + {children}
- } - -
+
+ } +
); } diff --git a/app/assets/javascripts/components/features/ui/containers/modal_container.jsx b/app/assets/javascripts/components/features/ui/containers/modal_container.jsx index cd7d63a4a..eeec55ff5 100644 --- a/app/assets/javascripts/components/features/ui/containers/modal_container.jsx +++ b/app/assets/javascripts/components/features/ui/containers/modal_container.jsx @@ -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 = () => ; + const Modal = React.createClass({ propTypes: { @@ -37,7 +41,11 @@ const Modal = React.createClass({ return ( - + ); } -- cgit