File size: 522 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import * as React from 'react'
import { lock, unlock } from './body-locker'

export type OverlayProps = React.HTMLAttributes<HTMLDivElement> & {
  fixed?: boolean
  ref?: React.Ref<HTMLDivElement>
}

const Overlay: React.FC<OverlayProps> = function Overlay({
  className,
  children,
  ...props
}) {
  React.useEffect(() => {
    lock()
    return () => {
      unlock()
    }
  }, [])

  return (
    <div data-nextjs-dialog-overlay className={className} {...props}>
      {children}
    </div>
  )
}

export { Overlay }