feat: updates

This commit is contained in:
qier222 2022-06-25 13:47:07 +08:00
parent f340a90117
commit cec4c5909d
No known key found for this signature in database
GPG key ID: 9C85007ED905F14D
50 changed files with 1304 additions and 207 deletions

View file

@ -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}</>
}