diff options
author | blackle <isabelle@blackle-mori.com> | 2017-04-13 09:04:18 -0400 |
---|---|---|
committer | blackle <isabelle@blackle-mori.com> | 2017-04-13 09:09:45 -0400 |
commit | 00cc3066a2781f1cc21b23677e797c7bfa9a2f6b (patch) | |
tree | 981cc202ad779b254f45e793d19178bc615e5e25 /app/assets/javascripts/components/features/ui | |
parent | a57d30c6800eb3ebe15b0398d5f542527faa47f9 (diff) |
Allow video to be expanded into lightbox
Diffstat (limited to 'app/assets/javascripts/components/features/ui')
3 files changed, 49 insertions, 1 deletions
diff --git a/app/assets/javascripts/components/features/ui/components/media_modal.jsx b/app/assets/javascripts/components/features/ui/components/media_modal.jsx index 35eb2cb0c..130f48b46 100644 --- a/app/assets/javascripts/components/features/ui/components/media_modal.jsx +++ b/app/assets/javascripts/components/features/ui/components/media_modal.jsx @@ -111,7 +111,7 @@ const MediaModal = React.createClass({ if (attachment.get('type') === 'image') { content = <ImageLoader src={url} imgProps={{ style: { display: 'block' } }} />; } else if (attachment.get('type') === 'gifv') { - content = <ExtendedVideoPlayer src={url} />; + content = <ExtendedVideoPlayer src={url} muted={true} controls={false} />; } return ( diff --git a/app/assets/javascripts/components/features/ui/components/modal_root.jsx b/app/assets/javascripts/components/features/ui/components/modal_root.jsx index e7ac02dde..74eb50039 100644 --- a/app/assets/javascripts/components/features/ui/components/modal_root.jsx +++ b/app/assets/javascripts/components/features/ui/components/modal_root.jsx @@ -1,10 +1,12 @@ import PureRenderMixin from 'react-addons-pure-render-mixin'; import MediaModal from './media_modal'; +import VideoModal from './video_modal'; import BoostModal from './boost_modal'; import { TransitionMotion, spring } from 'react-motion'; const MODAL_COMPONENTS = { 'MEDIA': MediaModal, + 'VIDEO': VideoModal, 'BOOST': BoostModal }; diff --git a/app/assets/javascripts/components/features/ui/components/video_modal.jsx b/app/assets/javascripts/components/features/ui/components/video_modal.jsx new file mode 100644 index 000000000..fa222d7aa --- /dev/null +++ b/app/assets/javascripts/components/features/ui/components/video_modal.jsx @@ -0,0 +1,46 @@ +import LoadingIndicator from '../../../components/loading_indicator'; +import PureRenderMixin from 'react-addons-pure-render-mixin'; +import ImmutablePropTypes from 'react-immutable-proptypes'; +import ExtendedVideoPlayer from '../../../components/extended_video_player'; +import { defineMessages, injectIntl } from 'react-intl'; +import IconButton from '../../../components/icon_button'; + +const messages = defineMessages({ + close: { id: 'lightbox.close', defaultMessage: 'Close' } +}); + +const closeStyle = { + position: 'absolute', + zIndex: '100', + top: '4px', + right: '4px' +}; + +const VideoModal = React.createClass({ + + propTypes: { + media: ImmutablePropTypes.map.isRequired, + onClose: React.PropTypes.func.isRequired, + intl: React.PropTypes.object.isRequired + }, + + mixins: [PureRenderMixin], + + render () { + const { media, intl, onClose } = this.props; + + const url = media.get('url'); + + return ( + <div className='modal-root__modal media-modal'> + <div> + <IconButton title={intl.formatMessage(messages.close)} icon='times' onClick={onClose} size={16} style={closeStyle} /> + <ExtendedVideoPlayer src={url} muted={false} controls={true} /> + </div> + </div> + ); + } + +}); + +export default injectIntl(VideoModal); |