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
a1b0bcf4d3
commit
884f3df41a
198 changed files with 4572 additions and 5336 deletions
|
|
@ -1,42 +0,0 @@
|
|||
import { motion, MotionConfig } from 'framer-motion'
|
||||
import { ease } from '@/web/utils/const'
|
||||
import useIsMobile from '@/web/hooks/useIsMobile'
|
||||
import scrollPositions from '@/web/states/scrollPositions'
|
||||
import { useLayoutEffect } from 'react'
|
||||
|
||||
const PageTransition = ({
|
||||
children,
|
||||
disableEnterAnimation,
|
||||
}: {
|
||||
children: React.ReactNode
|
||||
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}</>
|
||||
}
|
||||
|
||||
return (
|
||||
<MotionConfig transition={{ ease }}>
|
||||
<motion.div
|
||||
initial={{ opacity: disableEnterAnimation ? 1 : 0 }}
|
||||
animate={{ opacity: 1 }}
|
||||
exit={{ opacity: 0 }}
|
||||
transition={{ duration: 0.18 }}
|
||||
>
|
||||
{children}
|
||||
</motion.div>
|
||||
</MotionConfig>
|
||||
)
|
||||
}
|
||||
|
||||
export default PageTransition
|
||||
Loading…
Add table
Add a link
Reference in a new issue