From 3802ebfb2e8008c502578623ede794b157100a54 Mon Sep 17 00:00:00 2001 From: Anton Date: Thu, 7 Dec 2017 15:39:35 +0000 Subject: [PATCH 1/2] Add footer property --- src/Footer.react.js | 67 +++++++++++++++++++++++++-------------------- src/Popup.react.js | 3 ++ 2 files changed, 41 insertions(+), 29 deletions(-) diff --git a/src/Footer.react.js b/src/Footer.react.js index 4d4c797..d0ba9ee 100644 --- a/src/Footer.react.js +++ b/src/Footer.react.js @@ -3,37 +3,44 @@ import PropTypes from 'prop-types'; import ButtonsSpace from './ButtonsSpace.react'; const Component = (props) => { - if (!props.buttons) { - return null; - } + if (props.buttons) { + return ( + + ); + } else if (props.footer) { + return ( + + ); + } + return null; }; Component.displayName = 'PopupFooter'; @@ -56,6 +63,7 @@ Component.propTypes = { buttonClick: PropTypes.func, defaultOk: PropTypes.string, defaultCancel: PropTypes.string, + footer: PropTypes.any, }; Component.defaultProps = { buttons: null, @@ -64,6 +72,7 @@ Component.defaultProps = { btnClass: null, defaultOk: null, defaultCancel: null, + footer: null, buttonClick: () => {}, onOk: () => {}, onClose: () => {}, diff --git a/src/Popup.react.js b/src/Popup.react.js index 57048c3..c667b26 100644 --- a/src/Popup.react.js +++ b/src/Popup.react.js @@ -34,6 +34,7 @@ const initialState = { noOverlay: false, position: false, closeOnOutsideClick: true, + footer: null, }; class Component extends React.Component { @@ -247,6 +248,7 @@ class Component extends React.Component { noOverlay: popup.noOverlay, position: popup.position, closeOnOutsideClick: popup.closeOnOutsideClick, + footer: popup.footer, }, () => { key.setScope('react-popup'); @@ -422,6 +424,7 @@ class Component extends React.Component { defaultOk={this.props.defaultOk} defaultCancel={this.props.defaultCancel} buttons={this.state.buttons} + footer={this.state.footer} /> ); From bd36bb7c520e959aa7ac0baba51d2f486e6b9e5f Mon Sep 17 00:00:00 2001 From: Anton Date: Tue, 23 Jan 2018 13:13:24 +0000 Subject: [PATCH 2/2] emit id on close --- src/Store.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Store.js b/src/Store.js index c8caa39..14df67f 100644 --- a/src/Store.js +++ b/src/Store.js @@ -38,7 +38,7 @@ export default class PopupStore extends EventEmitter { const id = this.active; this.active = null; - this.emit(Constants.CLOSE); + this.emit(Constants.CLOSE, id); this.dispatch(); this.value = null;