diff --git a/src/components/others/TableOfContents.tsx b/src/components/others/TableOfContents.tsx index 8fb3a584..b8cd15bf 100644 --- a/src/components/others/TableOfContents.tsx +++ b/src/components/others/TableOfContents.tsx @@ -4,6 +4,7 @@ import Link from "next/link"; import { cn } from "@/lib/utils"; import { useEffect, useRef, useState } from "react"; import { usePathname } from "next/navigation"; +import { useScrollPosition } from "../../hooks/useScrollPosition"; /** * Automatically query all the heading anchors inside the
and creates a table of contents @@ -28,6 +29,7 @@ export function TableOfContentsSideBar(props: { filterHeading?: (heading: HTMLHeadingElement) => boolean; linkClassName?: string; }) { + const scrollPosition = useScrollPosition(); const [nodes, setNodes] = useState([]); const tocRef = useRef(null); const pathname = usePathname(); @@ -106,12 +108,13 @@ export function TableOfContentsSideBar(props: { observer.disconnect(); }; }, [pathname, filterHeading]); - + return (