样式调整;
顶部菜单调整
This commit is contained in:
tangly1024
2021-12-16 11:09:10 +08:00
parent 5bc16903c5
commit 71cc59f0d1
19 changed files with 417 additions and 215 deletions

View File

@@ -0,0 +1,28 @@
import { useEffect, useState } from 'react'
import DarkModeButton from './DarkModeButton'
let windowTop = 0
export default function FloatDarkModeButton () {
const [show, switchShow] = useState(false)
const scrollListener = () => {
const scrollY = window.pageYOffset
const shouldShow = scrollY > 100 && scrollY < windowTop
windowTop = scrollY
if (shouldShow !== show) {
switchShow(shouldShow)
}
}
useEffect(() => {
document.addEventListener('scroll', scrollListener)
return () => document.removeEventListener('scroll', scrollListener)
})
return (
<div
className={(show ? 'animate__fadeInRight ' : 'hidden lg:block') + ' animate__animated animate__faster shadow-card fixed right-5 bottom-36 py-1.5 px-2.5 rounded-full' +
' text-black shadow-card dark:border-gray-500 glassmorphism dark:bg-gray-700 dark:text-gray-200'}
>
<DarkModeButton />
</div>
)
}