mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-12-15 09:49:01 +05:30
#136: add an option to close popup by clicking on overlay
This commit is contained in:
parent
1d85a8cfa7
commit
9b093d1353
@ -29,7 +29,7 @@ export class PopupStack extends Component {
|
||||
: {...defaultProps, ...popup.props};
|
||||
|
||||
return (
|
||||
<div className={styles.overlay} key={popup.type + index}>
|
||||
<div className={styles.overlay} key={index} onClick={this.onOverlayClick(popup, props)}>
|
||||
<div className={styles.popupWrapper}>
|
||||
<div className={styles.popup}>
|
||||
<Popup {...props} />
|
||||
@ -45,6 +45,18 @@ export class PopupStack extends Component {
|
||||
onClose(popup) {
|
||||
return this.props.destroy.bind(null, popup);
|
||||
}
|
||||
|
||||
onOverlayClick(popup, popupProps) {
|
||||
return (event) => {
|
||||
if (event.target !== event.currentTarget || popupProps.disableOverlayClose) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
this.props.destroy(popup);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
import { connect } from 'react-redux';
|
||||
|
@ -76,6 +76,7 @@ export default connect(null, {
|
||||
return new Promise((resolve) => {
|
||||
dispatch(createPopup(PasswordRequestForm, (props) => ({
|
||||
form,
|
||||
disableOverlayClose: true,
|
||||
onSubmit: () => {
|
||||
form.beginLoading();
|
||||
sendData()
|
||||
|
Loading…
Reference in New Issue
Block a user