import React, {ReactNode, useState} from 'react';
import './imagelightbox.scss'
import {createPortal} from "react-dom";


type ImageLightboxProps = {
    children: ReactNode
    close: () => void
}

const ImageLightbox = ({children, close}: ImageLightboxProps) => {


    // const [isOpen, setIs0pen] = useState(false)

    return (
        createPortal (
            <div
                className="image-lightbox"
                onClick={(e) => {e.stopPropagation(); close()}}>
                {
                    children
                }
            </div>, document.body
        )

    );
}

export default ImageLightbox;
