docs: redesigned navigation (#9525)

Redesign navigation bar to reflect new design and allow for dropdowns

Closes DX-943
This commit is contained in:
Shahed Nasser
2024-10-11 10:10:00 +03:00
committed by GitHub
parent 7c5415ba3a
commit 49a91fd40e
63 changed files with 934 additions and 978 deletions
+1
View File
@@ -34,6 +34,7 @@ export default function RootLayout({
bodyClassName={clsx(inter.variable, robotoMono.variable)}
showToc={false}
showBanner={false}
showBreadcrumbs={false}
>
{children}
</WideLayout>
+5 -5
View File
@@ -1,5 +1,4 @@
import { DocsConfig } from "types"
import { getMobileSidebarItems } from "docs-ui"
const baseUrl = process.env.NEXT_PUBLIC_BASE_URL || "http://localhost:3000"
@@ -16,9 +15,10 @@ export const config: DocsConfig = {
loaded: true,
},
],
mobile: getMobileSidebarItems({
baseUrl,
version: "v2",
}),
mobile: [],
},
project: {
title: "API Reference",
key: "api-reference",
},
}
@@ -8,8 +8,6 @@ import {
} from "docs-ui"
import { useMemo } from "react"
import { config } from "../config"
import { usePathname } from "next/navigation"
import basePathUrl from "../utils/base-path-url"
type MainNavProviderProps = {
children?: React.ReactNode
@@ -17,15 +15,12 @@ type MainNavProviderProps = {
export const MainNavProvider = ({ children }: MainNavProviderProps) => {
const { isBrowser } = useIsBrowser()
const pathname = usePathname()
const navigationDropdownItems = useMemo(
() =>
getNavDropdownItems({
basePath: config.baseUrl,
activePath: basePathUrl(pathname),
version: "v2",
}),
[pathname]
[]
)
const reportLink = useMemo(
+2 -2
View File
@@ -3,7 +3,7 @@
import {
usePageLoading,
SearchProvider as UiSearchProvider,
searchFiltersV2,
searchFilters,
AiAssistantIcon,
AiAssistantProvider,
} from "docs-ui"
@@ -51,7 +51,7 @@ const SearchProvider = ({ children }: SearchProviderProps) => {
checkInternalPattern: new RegExp(
`^${config.baseUrl}${basePathUrl(`/(admin|store)`)}`
),
filterOptions: searchFiltersV2,
filterOptions: searchFilters,
}}
commands={[
{