import { useMemo, useState } from 'react'; import { Scrollbars } from 'react-custom-scrollbars-2'; const LINK_HEIGHT = 30; const INDICATOR_SIZE = 10; const INDICATOR_OFFSET = (LINK_HEIGHT - INDICATOR_SIZE) / 2; export function Outline({ headings }: { readonly headings: any[] }) { // eslint-disable-next-line react/hook-use-state const [active /* setActive */] = useState(0); const headingItems = useMemo( () => headings.map((heading, idx) => ( {heading.text} )), [headings, active], ); // useEffect(() => { // const idx = headings.findIndex((heading) => heading.slug === state.hash?.slice(1)); // if (idx >= 0) { // setActive(idx); // } // }, [state, headings]); return (
} renderTrackVertical={(props) => (
)} universal >
{/* */} Contents
{headingItems}
); }