feat: updates

This commit is contained in:
qier222 2022-06-14 23:23:34 +08:00
parent 8f4c3d8e5b
commit f340a90117
No known key found for this signature in database
GPG key ID: 9C85007ED905F14D
34 changed files with 781 additions and 323 deletions

View file

@ -78,9 +78,12 @@ const TabName = () => {
}
const Tabs = () => {
const location = useLocation()
const navigate = useNavigate()
const controls = useAnimation()
const [active, setActive] = useState<string>(tabs[0].path)
const [active, setActive] = useState<string>(
location.pathname || tabs[0].path
)
const animate = async (path: string) => {
await controls.start((p: string) =>
@ -96,7 +99,12 @@ const Tabs = () => {
key={tab.name}
animate={controls}
transition={{ ease, duration: 0.18 }}
onMouseDown={() => animate(tab.path)}
onMouseDown={() => {
if ('vibrate' in navigator) {
navigator.vibrate(20)
}
animate(tab.path)
}}
onClick={() => {
setActive(tab.path)
navigate(tab.path)