闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.2 KiB

  1. import React from 'react';
  2. import ImmutablePropTypes from 'react-immutable-proptypes';
  3. import PropTypes from 'prop-types';
  4. import ExtendedVideoPlayer from '../../../components/extended_video_player';
  5. import { defineMessages, injectIntl } from 'react-intl';
  6. import IconButton from '../../../components/icon_button';
  7. import ImmutablePureComponent from 'react-immutable-pure-component';
  8. const messages = defineMessages({
  9. close: { id: 'lightbox.close', defaultMessage: 'Close' },
  10. });
  11. @injectIntl
  12. export default class VideoModal extends ImmutablePureComponent {
  13. static propTypes = {
  14. media: ImmutablePropTypes.map.isRequired,
  15. time: PropTypes.number,
  16. onClose: PropTypes.func.isRequired,
  17. intl: PropTypes.object.isRequired,
  18. };
  19. render () {
  20. const { media, intl, time, onClose } = this.props;
  21. const url = media.get('url');
  22. return (
  23. <div className='modal-root__modal media-modal'>
  24. <div>
  25. <div className='media-modal__close'><IconButton title={intl.formatMessage(messages.close)} icon='times' overlay onClick={onClose} /></div>
  26. <ExtendedVideoPlayer src={url} muted={false} controls time={time} />
  27. </div>
  28. </div>
  29. );
  30. }
  31. }