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.
mvfront-react/src/components/form/ModalConfirm.jsx

54 lines
1.2 KiB

/* eslint react/prop-types: 0 */
4 years ago
import React, { Component } from "react";
import { Button, Modal, ModalHeader, ModalBody, ModalFooter } from "reactstrap";
class ModalConfirm extends Component {
4 years ago
constructor(props) {
super(props);
this.state = {
modal: false
};
4 years ago
}
4 years ago
toggle = () => {
this.setState({
modal: !this.state.modal
});
};
getComponent = key => {
return this.props.children.filter(comp => {
return comp.key === key;
});
};
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>
);
}
}
4 years ago
export default ModalConfirm;