feat: updates

This commit is contained in:
qier222 2022-08-22 16:51:23 +08:00
parent ebebf2a733
commit a1b0bcf4d3
No known key found for this signature in database
GPG key ID: 9C85007ED905F14D
68 changed files with 4776 additions and 5559 deletions

View file

@ -0,0 +1,21 @@
import { useEffect } from 'react'
const useLockMainScroll = (lock: boolean) => {
useEffect(() => {
const main = document.querySelector('#main') as HTMLElement | null
if (!main) {
throw new Error('Main element not found')
}
if (lock) {
main.style.overflow = 'hidden'
} else {
main.style.overflow = 'auto'
}
return () => {
main.style.overflow = 'auto'
}
}, [lock])
}
export default useLockMainScroll