mirror of
https://github.com/netbirdio/docs.git
synced 2026-09-26 00:39:04 +02:00
Add nested navigation links (#112)
Co-authored-by: Eduard Gert <eduard@netbird.io> Co-authored-by: braginini <bangvalo@gmail.com>
This commit is contained in:
co-authored by
Eduard Gert
braginini
parent
464530a4d8
commit
ddc65c7ae0
@@ -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
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user