// customized navbar component, modified from https://github.com/shuding/nextra/blob/c8238813e1ba425cdd72783d57707b0ff3ca52ea/examples/custom-theme/app/_components/navbar.tsx#L9 // Rebuild from source code https://github.com/shuding/nextra/tree/c8238813e1ba425cdd72783d57707b0ff3ca52ea/packages/nextra-theme-docs/src/components/navbar 'use client' import type { PageMapItem } from 'nextra' import { Anchor } from 'nextra/components' import type { FC, ReactNode } from 'react' import cn from 'clsx' // eslint-disable-next-line no-restricted-imports -- since we don't need `newWindow` prop import NextLink from 'next/link' import { DiscordIcon, GitHubIcon } from 'nextra/icons' import { ClientNavbar } from './navbar.client' // export const Navbar: FC<{ pageMap: PageMapItem[] }> = ({ pageMap }) => { // const pathname = usePathname() // const { topLevelNavbarItems } = normalizePages({ // list: pageMap, // route: pathname // }) // return ( // // ) // } /* TODO: eslint typescript-sort-keys/interface: error */ interface NavbarProps { /** * Page map. */ pageMap: PageMapItem[] /** * Extra content after the last icon. */ children?: ReactNode /** * Specifies whether the logo should have a link or provides the URL for the logo's link. * @default true */ logoLink?: string | boolean /** * Logo of the website. */ logo: ReactNode /** * URL of the project homepage. */ projectLink?: string /** * Icon of the project link. * @default */ projectIcon?: ReactNode /** * URL of the chat link. */ chatLink?: string /** * Icon of the chat link. * @default */ chatIcon?: ReactNode /** * CSS class name. */ className?: string /** * Aligns navigation links to the specified side. * @default 'right' */ align?: 'left' | 'right' } // Fix compiler error // Expression type `JSXElement` cannot be safely reordered const defaultGitHubIcon = ( ) const defaultChatIcon = export const Navbar: FC = ({ pageMap, children, logoLink = true, logo, projectLink, projectIcon = defaultGitHubIcon, chatLink, chatIcon = defaultChatIcon, className, align = 'right' }) => { const logoClass = cn( 'x:flex x:items-center', align === 'left' ? 'x:max-md:me-auto' : 'x:me-auto' ) return (
) }