Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add footer #32

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 38 additions & 29 deletions src/Footer.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<footer className={props.className}>
<ButtonsSpace
buttonClick={props.buttonClick}
onOk={props.onOk}
onClose={props.onClose}
className={`${props.className}__left-space`}
wildClasses={props.wildClasses}
btnClass={props.btnClass}
defaultOk={props.defaultOk}
defaultCancel={props.defaultCancel}
buttons={props.buttons.left}
/>

return (
<footer className={props.className}>
<ButtonsSpace
buttonClick={props.buttonClick}
onOk={props.onOk}
onClose={props.onClose}
className={`${props.className}__left-space`}
wildClasses={props.wildClasses}
btnClass={props.btnClass}
defaultOk={props.defaultOk}
defaultCancel={props.defaultCancel}
buttons={props.buttons.left}
/>
{props.footer}

<ButtonsSpace
buttonClick={props.buttonClick}
onOk={props.onOk}
onClose={props.onClose}
className={`${props.className}__right-space`}
wildClasses={props.wildClasses}
btnClass={props.btnClass}
defaultOk={props.defaultOk}
defaultCancel={props.defaultCancel}
buttons={props.buttons.right}
/>
</footer>
);
<ButtonsSpace
buttonClick={props.buttonClick}
onOk={props.onOk}
onClose={props.onClose}
className={`${props.className}__right-space`}
wildClasses={props.wildClasses}
btnClass={props.btnClass}
defaultOk={props.defaultOk}
defaultCancel={props.defaultCancel}
buttons={props.buttons.right}
/>
</footer>
);
} else if (props.footer) {
return (
<footer className={props.className}>
{props.footer}
</footer>
);
}
return null;
};

Component.displayName = 'PopupFooter';
Expand All @@ -56,6 +63,7 @@ Component.propTypes = {
buttonClick: PropTypes.func,
defaultOk: PropTypes.string,
defaultCancel: PropTypes.string,
footer: PropTypes.any,
};
Component.defaultProps = {
buttons: null,
Expand All @@ -64,6 +72,7 @@ Component.defaultProps = {
btnClass: null,
defaultOk: null,
defaultCancel: null,
footer: null,
buttonClick: () => {},
onOk: () => {},
onClose: () => {},
Expand Down
3 changes: 3 additions & 0 deletions src/Popup.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const initialState = {
noOverlay: false,
position: false,
closeOnOutsideClick: true,
footer: null,
};

class Component extends React.Component {
Expand Down Expand Up @@ -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');

Expand Down Expand Up @@ -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}
/>
</article>
);
Expand Down
2 changes: 1 addition & 1 deletion src/Store.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down