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';
|
2019-09-05 15:36:11 +12:00
|
|
|
import Icon from '../../components/Icon';
|
|
|
|
|
|
2019-11-15 13:50:39 +13:00
|
|
|
class Modal extends React.Component {
|
|
|
|
|
componentDidMount() {
|
2019-09-05 15:36:11 +12:00
|
|
|
$('body').addClass('modal-open');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentWillUnmount() {
|
|
|
|
|
$('body').removeClass('modal-open');
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-15 13:50:39 +13:00
|
|
|
render() {
|
2020-02-15 21:45:29 +13:00
|
|
|
const {
|
|
|
|
|
extraControls = null,
|
|
|
|
|
noclose = false,
|
|
|
|
|
children,
|
|
|
|
|
className = '',
|
|
|
|
|
} = this.props;
|
2019-09-05 15:36:11 +12:00
|
|
|
|
|
|
|
|
return (
|
2020-02-15 21:45:29 +13:00
|
|
|
<div className={`modal ${className}`}>
|
2019-09-05 15:36:11 +12:00
|
|
|
|
|
|
|
|
<div className="controls">
|
2020-02-15 21:45:29 +13:00
|
|
|
{!noclose && (
|
2019-09-05 15:36:11 +12:00
|
|
|
<div className="control close" onClick={(e) => window.history.back()}>
|
|
|
|
|
<Icon name="close" className="white" />
|
2019-11-15 13:50:39 +13:00
|
|
|
</div>
|
2020-02-15 21:45:29 +13:00
|
|
|
)}
|
|
|
|
|
{extraControls}
|
2019-09-05 15:36:11 +12:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="content">
|
2020-02-15 21:45:29 +13:00
|
|
|
{children}
|
2019-09-05 15:36:11 +12:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
2018-07-08 21:12:18 +12:00
|
|
|
}
|
|
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
const mapStateToProps = (state, ownProps) => ({
|
|
|
|
|
shortkeys_enabled: state.ui.shortkeys_enabled,
|
|
|
|
|
});
|
2018-07-08 21:12:18 +12:00
|
|
|
|
2019-09-05 15:36:11 +12:00
|
|
|
const mapDispatchToProps = (dispatch) => ({});
|
2018-07-08 21:12:18 +12:00
|
|
|
|
2019-11-15 13:50:39 +13:00
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(Modal);
|