You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.2 KiB
53 lines
1.2 KiB
4 years ago
|
import React, { Component } from "react";
|
||
|
import { Button, Modal, ModalHeader, ModalBody, ModalFooter } from "reactstrap";
|
||
5 years ago
|
|
||
|
class ModalConfirm extends Component {
|
||
4 years ago
|
constructor(props) {
|
||
|
super(props);
|
||
|
this.state = {
|
||
|
modal: false
|
||
5 years ago
|
};
|
||
4 years ago
|
}
|
||
5 years ago
|
|
||
4 years ago
|
toggle = () => {
|
||
|
this.setState({
|
||
|
modal: !this.state.modal
|
||
|
});
|
||
|
};
|
||
|
|
||
|
getComponent = key => {
|
||
|
return this.props.children.filter(comp => {
|
||
|
return comp.key === key;
|
||
|
});
|
||
|
};
|
||
5 years ago
|
|
||
4 years ago
|
render() {
|
||
|
return (
|
||
|
<Modal
|
||
|
isOpen={this.state.modal}
|
||
|
toggle={this.toggle}
|
||
|
className={this.props.className + " modal-dialog-centered"}
|
||
|
>
|
||
|
<ModalHeader toggle={this.toggle}>
|
||
|
{this.getComponent("title")}
|
||
|
</ModalHeader>
|
||
|
<ModalBody>{this.getComponent("body")}</ModalBody>
|
||
|
<ModalFooter>
|
||
|
<Button
|
||
|
color="primary-outline"
|
||
|
className="text-primary border-primary"
|
||
|
onClick={this.toggle}
|
||
|
>
|
||
|
{this.getComponent("cancel")}
|
||
|
</Button>
|
||
|
<Button color="primary" onClick={this.toggle}>
|
||
|
{this.getComponent("confirm")}
|
||
|
</Button>
|
||
|
</ModalFooter>
|
||
|
</Modal>
|
||
|
);
|
||
|
}
|
||
5 years ago
|
}
|
||
|
|
||
4 years ago
|
export default ModalConfirm;
|