import * as React from "react";
import { Modal } from "react-bootstrap";

type ConfirmationModalProps = {
	onHide(): void,
	bodyText: string
	modalTitle: string,
	onConfirmClick(): void,
	show: boolean
};

export const ConfirmationModal = ({ bodyText, modalTitle, onConfirmClick, onHide, show }: ConfirmationModalProps) => {
	return (
		<React.Fragment>
			<Modal
				show={show}
				onHide={onHide}
				backdrop="static"
				keyboard={false}
			>
				<Modal.Header closeButton>
					<Modal.Title>{modalTitle}</Modal.Title>
				</Modal.Header>

				<Modal.Body>
					{bodyText}
				</Modal.Body>

				<Modal.Footer>
					<button type="button" onClick={() => { onConfirmClick(); onHide(); }} className="primary-btn">Potvrdit</button>
					<button type="button" onClick={onHide} className="danger-btn">Zrušit</button>
				</Modal.Footer>

			</Modal>
		</React.Fragment>
	);
}