diff --git a/next/src/components/Navigation/NavGroup.tsx b/next/src/components/Navigation/NavGroup.tsx index e3a15fd..3418645 100644 --- a/next/src/components/Navigation/NavGroup.tsx +++ b/next/src/components/Navigation/NavGroup.tsx @@ -8,8 +8,6 @@ import Link from 'next/link' import { useRouter } from 'next/router' import { NavigationGroup } from './config' import NavLink from './NavLink' -import { VisibleSectionHighlight } from './VisibleSectionHighlight' -import { remToPx } from '@/lib/remToPx' interface NavGroupProps { group: NavigationGroup @@ -25,16 +23,11 @@ export function NavGroup({ group, className }: NavGroupProps) { [useRouter(), useSectionStore((s: any) => s.sections)], isInsideMobileNavigation, ) - let isActiveGroup = group.group.href === router.pathname || (group.links && group.links.findIndex((link) => link.href === router.pathname) !== -1) - const groupTitleHeight = document.getElementById( - `${group.group.href}-link`, - )?.offsetHeight - return (
  • - {group.group.title} + {group.group.title}{' '} + {group.group.href === router.pathname && ( +
    + )} -
    - - {isActiveGroup && ( - - )} - -
    +
    +
      {group.links?.map((link) => ( - + {link.title} + {link.href === router.pathname && ( +
      + )} {link.href === router.pathname && sections.length > 0 && ( @@ -89,7 +97,7 @@ export function NavGroup({ group, className }: NavGroupProps) { }} > {sections.map((section: any) => ( -
    • +
    • s.sections), - useSectionStore((s: any) => s.visibleSections), - ], - useIsInsideMobileNavigation(), - ) - - const [uselessCounter, setUselessCounter] = useState(0) - let height = 0 - let top = 0 - - function renderAgain() { - setTimeout(() => { - setUselessCounter(uselessCounter + 1) - }, 100) - } - - const activeNavItem = document.getElementById(`${pathname}-link`) - if (activeNavItem) { - if (visibleSections[0] === '_top' || visibleSections.length === 0) { - height = activeNavItem.offsetHeight - top = activeNavItem.offsetTop - if (top === 0) { - renderAgain() - } - } else { - top = document.getElementById(`${visibleSections[0]}-li`)!.offsetTop - } - for (let i = 0; i < visibleSections.length; i++) { - if (visibleSections[i] === '_top') continue - height += document.getElementById( - `${visibleSections[i]}-li`, - )!.offsetHeight - } - height += 8 - } else { - // Wait a bit and force a re-render. `activeNavItem` should exist - renderAgain() - } - - return ( - - ) -}