diff --git a/src/components/Footer.jsx b/src/components/Footer.jsx index 1f11812a..631ce01a 100644 --- a/src/components/Footer.jsx +++ b/src/components/Footer.jsx @@ -1,10 +1,10 @@ -import {forwardRef, Fragment, useEffect, useState} from 'react' +import {forwardRef, Fragment, useState} from 'react' import Link from 'next/link' import { useRouter } from 'next/router' import { Transition } from '@headlessui/react' import { Button } from '@/components/Button' -import {apiNavigation} from '@/components/NavigationAPI' +import {apiNavigation, flattenNavItems} from '@/components/NavigationAPI' import {docsNavigation} from "@/components/NavigationDocs"; function CheckIcon(props) { @@ -126,7 +126,9 @@ function PageLink({ label, page, previous = false }) { function PageNavigation() { let router = useRouter() - let allPages = !router.route.startsWith('/ipa') ? docsNavigation.flatMap((group) => group.links) : apiNavigation.flatMap((group) => group.links) + let allPages = !router.route.startsWith('/ipa') + ? docsNavigation.flatMap((group) => flattenNavItems(group.links, true)) + : apiNavigation.flatMap((group) => flattenNavItems(group.links,true)); let currentPageIndex = allPages.findIndex( (page) => page.href === router.pathname ) diff --git a/src/components/NavigationAPI.jsx b/src/components/NavigationAPI.jsx index 4e2ef896..be461c52 100644 --- a/src/components/NavigationAPI.jsx +++ b/src/components/NavigationAPI.jsx @@ -1,11 +1,12 @@ import Link from 'next/link' import { useRouter } from 'next/router' import clsx from 'clsx' -import { AnimatePresence, motion, useIsPresent } from 'framer-motion' +import { AnimatePresence, motion } from 'framer-motion' import { Button } from '@/components/Button' import { Tag } from '@/components/Tag' import { remToPx } from '@/lib/remToPx' -import {useIsInsideMobileNavigation} from "@/components/MobileNavigation"; +import {useEffect, useState} from "react"; +import {NavigationStateProvider, useNavigationState} from "@/components/NavigationState"; export const apiNavigation = [ { @@ -46,12 +47,13 @@ export function NavigationAPI({tableOfContents, className}) { Github Support {apiNavigation.map((group, groupIndex) => ( + + ))}