Files
Iris/src/js/views/modals/Modal.js

54 lines
1.2 KiB
JavaScript
Raw Normal View History

2018-07-08 21:12:18 +12:00
import React from 'react';
2018-07-08 21:12:18 +12:00
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
2019-09-05 15:36:11 +12:00
import * as helpers from '../../helpers';
import Icon from '../../components/Icon';
class Modal extends React.Component {
2019-09-05 15:36:11 +12:00
constructor(props) {
super(props);
}
componentDidMount() {
2019-09-05 15:36:11 +12:00
$('body').addClass('modal-open');
}
componentWillUnmount() {
$('body').removeClass('modal-open');
}
render() {
2019-09-05 15:36:11 +12:00
let className = 'modal';
if (this.props.className) {
className += ` ${this.props.className}`;
}
return (
<div className={className}>
<div className="controls">
{this.props.noclose ? null : (
2019-09-05 15:36:11 +12:00
<div className="control close" onClick={(e) => window.history.back()}>
<Icon name="close" className="white" />
</div>
2019-09-05 15:36:11 +12:00
) }
</div>
<div className="content">
{this.props.children}
</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
export default connect(mapStateToProps, mapDispatchToProps)(Modal);