mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-17 13:48:02 +00:00
feat: updates
This commit is contained in:
parent
f340a90117
commit
cec4c5909d
50 changed files with 1304 additions and 207 deletions
|
|
@ -1,6 +1,8 @@
|
|||
import { motion } from 'framer-motion'
|
||||
import { ease } from '@/web/utils/const'
|
||||
import useIsMobile from '@/web/hooks/useIsMobile'
|
||||
import scrollPositions from '@/web/store/scrollPositions'
|
||||
import { useLayoutEffect } from 'react'
|
||||
|
||||
const PageTransition = ({
|
||||
children,
|
||||
|
|
@ -10,6 +12,15 @@ const PageTransition = ({
|
|||
disableEnterAnimation?: boolean
|
||||
}) => {
|
||||
const isMobile = useIsMobile()
|
||||
|
||||
// To restore scroll position
|
||||
useLayoutEffect(() => {
|
||||
const main = document.querySelector('main')
|
||||
if (main) {
|
||||
main.scrollTop = scrollPositions.get(window.location.pathname) ?? 0
|
||||
}
|
||||
}, [])
|
||||
|
||||
if (isMobile) {
|
||||
return <>{children}</>
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue