2018-07-08 21:12:18 +12:00
|
|
|
|
2019-02-10 19:51:33 +13:00
|
|
|
import React from 'react';
|
2018-07-08 21:12:18 +12:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
|
import { bindActionCreators } from 'redux';
|
|
|
|
|
|
|
|
|
|
import * as helpers from '../../helpers'
|
|
|
|
|
import Icon from '../../components/Icon'
|
|
|
|
|
|
|
|
|
|
class Modal extends React.Component{
|
|
|
|
|
|
|
|
|
|
constructor(props){
|
|
|
|
|
super(props);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentWillMount(){
|
2018-10-24 16:56:06 +13:00
|
|
|
$('body').addClass('modal-open');
|
2018-07-08 21:12:18 +12:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentWillUnmount(){
|
2018-10-24 16:56:06 +13:00
|
|
|
$('body').removeClass('modal-open');
|
2018-07-08 21:12:18 +12:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render(){
|
|
|
|
|
|
|
|
|
|
var className = "modal";
|
|
|
|
|
if (this.props.className){
|
|
|
|
|
className += " "+this.props.className;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className={className}>
|
|
|
|
|
|
|
|
|
|
<div className="controls">
|
2018-07-21 22:00:12 +12:00
|
|
|
{this.props.noclose ? null : <div className="control close" onClick={e => window.history.back()}>
|
2018-07-08 21:12:18 +12:00
|
|
|
<Icon name="close" className="white" />
|
2018-07-21 22:00:12 +12:00
|
|
|
</div> }
|
2018-07-08 21:12:18 +12:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="content">
|
|
|
|
|
{this.props.children}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const mapStateToProps = (state, ownProps) => {
|
|
|
|
|
return {
|
|
|
|
|
shortkeys_enabled: state.ui.shortkeys_enabled
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const mapDispatchToProps = (dispatch) => {
|
|
|
|
|
return {}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(Modal)
|