import React from "react"

interface Props {
	show: boolean
	onCloseClick?: ()=>void
}

const Modal: React.FC<Props> = (props) => {
	return (
		<div 
			className={`${!props.show?"hidden":"" } 
			fixed z-10 left-0 top-0 w-full h-full 
			flex justify-center items-center bg-white bg-opacity-80`}
			onClick={()=>{
				props.onCloseClick?.()
			}}>
			<div className="bg-white mx-auto p-5 border-2 w-10/12 overflow-hidden max-h-full" onClick={(e)=>{
				e.stopPropagation()
			}}>
				{props.children}
			</div>
		</div>
	)
}

export default Modal