import React from "react";
import ConfirmationModalComponent from './ConfirmationModalComponent';
import { openModal } from './Modal.js';

export default class ConfirmationModal extends React.Component {
  showModal() {
    openModal(this.props.modalKey, {
      Component: ConfirmationModalComponent,
      Heading: this.props.heading,
      height: this.props.height || 250,
      width: this.props.width || 400,
      modalKey: this.props.modalKey,
      configurable: this.props.configurable,
      body: this.props.body,
      callBack: this.props.callBack,
      buttonComponent: this.props.buttonComponent,
      reasons: this.props.reasons,
      onReasonSelect: this.props.onReasonSelect
    });
  }

  render() {
    return (
      <div onClick={() => {this.showModal();}}>
        {this.props.children}
      </div>
    );
  }
}
