import React, { ReactNode } from 'react';

interface ModalWindowtProps {
	children: ReactNode | null;
	state: boolean;
	callBack: (value: boolean) => void;
}

export default function ModalWindow({ children, state, callBack }: ModalWindowtProps) {
	return (
		<>
			{state && (
				<div
					className="modal-wrapper"
					onClick={() => {
						callBack(false);
					}}
				>
					<div
						className="modal-window"
						onClick={(e) => e.stopPropagation()}
					>
						{children}
					</div>
				</div>
			)}
		</>
	)
}