import React from "react"; import { Button } from "./"; import { confirm } from "../helpers/"; import { Popup } from "./popup"; import { t } from "../locales/"; export class ModalConfirm extends Popup { constructor(props) { super(props); } componentDidMount() { confirm.subscribe((Component, yesCallback, noCallback) => { this.setState({ appear: true, value: Component, fns: { yes: yesCallback, no: noCallback }, }); }); } modalContentBody() { return (
{this.state.value}
); } yes() { if (this.state.fns && typeof this.state.fns.yes === "function") { this.state.fns.yes(); } this.setState({ appear: false }); } no() { if (this.state.fns && typeof this.state.fns.no === "function") { this.state.fns.no(); } this.setState({ appear: false }); } modalContentFooter() { return (
); } }