/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ import React, {type ComponentProps, type ReactNode} from 'react'; import {useThemeConfig} from '@docusaurus/theme-common'; import {useNavbarSecondaryMenu} from '@docusaurus/theme-common/internal'; import Translate from '@docusaurus/Translate'; function SecondaryMenuBackButton(props: ComponentProps<'button'>) { return ( ); } // The secondary menu slides from the right and shows contextual information // such as the docs sidebar export default function NavbarMobileSidebarSecondaryMenu(): ReactNode { const isPrimaryMenuEmpty = useThemeConfig().navbar.items.length === 0; const secondaryMenu = useNavbarSecondaryMenu(); return ( <> {/* edge-case: prevent returning to the primaryMenu when it's empty */} {!isPrimaryMenuEmpty && ( secondaryMenu.hide()} /> )} {secondaryMenu.content} ); }