mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-17 05:38:04 +00:00
feat: updates
This commit is contained in:
parent
ebebf2a733
commit
a1b0bcf4d3
68 changed files with 4776 additions and 5559 deletions
21
packages/web/hooks/useLockMainScroll.ts
Normal file
21
packages/web/hooks/useLockMainScroll.ts
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue