Improve HK sidebar and restore nested content scrolling
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
"use client";
|
||||
|
||||
import { Lenis } from "lenis/react";
|
||||
import { usePathname } from "next/navigation";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
export function SmoothScroll() {
|
||||
const pathname = usePathname();
|
||||
const isAdmin = pathname === "/admin" || pathname?.startsWith("/admin/");
|
||||
const [prefersReduced, setPrefersReduced] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -14,7 +17,8 @@ export function SmoothScroll() {
|
||||
return () => mq.removeEventListener("change", onChange);
|
||||
}, []);
|
||||
|
||||
if (prefersReduced) return null;
|
||||
// Admin panels own their scroll containers; root wheel smoothing consumes their events.
|
||||
if (prefersReduced || isAdmin) return null;
|
||||
|
||||
return (
|
||||
<Lenis
|
||||
|
||||
Reference in New Issue
Block a user