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.

67 lines
1.4 KiB

  1. import { connect } from 'react-redux';
  2. import { SkyLightStateless } from 'react-skylight';
  3. import { closeModal } from '../../../actions/modal';
  4. const mapStateToProps = state => ({
  5. url: state.getIn(['modal', 'url']),
  6. isVisible: state.getIn(['modal', 'open'])
  7. });
  8. const mapDispatchToProps = dispatch => ({
  9. onCloseClicked () {
  10. dispatch(closeModal());
  11. },
  12. onOverlayClicked () {
  13. dispatch(closeModal());
  14. }
  15. });
  16. const styles = {
  17. overlayStyles: {
  18. },
  19. dialogStyles: {
  20. width: '600px',
  21. color: '#282c37',
  22. fontSize: '16px',
  23. lineHeight: '37px',
  24. marginTop: '-300px',
  25. left: '0',
  26. right: '0',
  27. marginLeft: 'auto',
  28. marginRight: 'auto',
  29. height: 'auto'
  30. },
  31. imageStyle: {
  32. display: 'block',
  33. maxWidth: '100%',
  34. height: 'auto',
  35. margin: '0 auto'
  36. }
  37. };
  38. const Modal = React.createClass({
  39. propTypes: {
  40. url: React.PropTypes.string,
  41. isVisible: React.PropTypes.bool,
  42. onCloseClicked: React.PropTypes.func,
  43. onOverlayClicked: React.PropTypes.func
  44. },
  45. render () {
  46. const { url, ...other } = this.props;
  47. return (
  48. <SkyLightStateless {...other} dialogStyles={styles.dialogStyles} overlayStyles={styles.overlayStyles}>
  49. <img src={url} style={styles.imageStyle} />
  50. </SkyLightStateless>
  51. );
  52. }
  53. });
  54. export default connect(mapStateToProps, mapDispatchToProps)(Modal);