2022-11-29 16:45:00 +00:00
|
|
|
import classNames from 'classnames'
|
|
|
|
import { ReactNode } from 'react'
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
children?: ReactNode | string
|
|
|
|
content?: ReactNode | string
|
|
|
|
className?: string
|
|
|
|
show: boolean
|
|
|
|
setShow: (show: boolean) => void
|
|
|
|
}
|
|
|
|
|
|
|
|
const Overlay = ({ children, content, className, show, setShow }: Props) => {
|
|
|
|
const onClickAway = () => {
|
|
|
|
setShow(false)
|
|
|
|
}
|
|
|
|
|
|
|
|
return show ? (
|
|
|
|
<>
|
|
|
|
<div
|
|
|
|
className={classNames(
|
2022-12-06 09:20:22 +00:00
|
|
|
'max-w-screen absolute z-50 rounded-lg shadow-overlay gradient-popover',
|
2022-11-29 16:45:00 +00:00
|
|
|
className,
|
|
|
|
)}
|
|
|
|
>
|
|
|
|
{children ? children : content}
|
|
|
|
</div>
|
|
|
|
<div
|
|
|
|
className='fixed top-0 left-0 z-40 block h-full w-full hover:cursor-pointer'
|
|
|
|
onClick={onClickAway}
|
|
|
|
role='button'
|
|
|
|
/>
|
|
|
|
</>
|
|
|
|
) : null
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Overlay
|