Refractor

This commit is contained in:
gowarezzz
2021-08-19 09:50:38 +07:00
parent 0e7e7b7d5f
commit 0f82dfdcba
441 changed files with 191 additions and 81002 deletions

View File

@@ -27,15 +27,13 @@ const Modal: FC<ModalProps> = ({ children, onClose }) => {
)
useEffect(() => {
const modal = ref.current
if (modal) {
disableBodyScroll(modal, { reserveScrollBarGap: true })
if (ref.current) {
disableBodyScroll(ref.current, { reserveScrollBarGap: true })
window.addEventListener('keydown', handleKey)
}
return () => {
if (modal) {
enableBodyScroll(modal)
if (ref && ref.current) {
enableBodyScroll(ref.current)
}
clearAllBodyScrollLocks()
window.removeEventListener('keydown', handleKey)