T45c Site · Home: a route change ends the glide, full screen holds against the wheel, each skip control focuses its own target

This commit is contained in:
ZacharyZhang-NY committed 2026-10-01 08:38:05 -04:00
1 parent 23ebaba2a1
commit e2b9670043
2 files changed
+14 -7

No files matched your search

+9 -3
View File
@@ -1,4 +1,4 @@
import { Link, Outlet } from "@tanstack/react-router";
import { Link, Outlet, useRouter } from "@tanstack/react-router";
import Lenis from "lenis";
import "lenis/dist/lenis.css";
import { useEffect } from "react";
@@ -58,11 +58,17 @@ function Footer() {
export function Shell() {
const still = useStill();
const router = useRouter();
useEffect(() => {
if (still) return;
const lenis = new Lenis({ autoRaf: true });
return () => lenis.destroy();
}, [still]);
// A glide in flight must not outlive its page.
const off = router.subscribe("onBeforeNavigate", () => lenis.scrollTo(lenis.animatedScroll, { immediate: true, force: true }));
return () => {
off();
lenis.destroy();
};
}, [still, router]);
return (
<>
<a className="skip" href="#main">