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

type WarningModalProps = {
	onHide(): void,
	bodyText: string[],
	modalTitle: string,
	show: boolean
};

export const WarningModal = ({ bodyText, modalTitle, onHide, show }: WarningModalProps) => {
	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.map((item: string) => {
						return parse(item);
					})}
				</Modal.Body>

				<Modal.Footer>
					<button type="button" onClick={onHide} className="primary-btn">Ok</button>
				</Modal.Footer>

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