diff --git a/src/components/Button/Button.tsx b/src/components/Button/Button.tsx index 7644d15..4d77fd8 100644 --- a/src/components/Button/Button.tsx +++ b/src/components/Button/Button.tsx @@ -10,5 +10,10 @@ export const Button = ( props: TProps & HTMLProps, ): JSX.Element => { const { children, className, ...rest } = props - return + + return ( + + ) } diff --git a/src/theme/Navbar/Content/styles.module.scss b/src/theme/Navbar/Content/styles.module.scss index 64b1efa..90a7e4d 100644 --- a/src/theme/Navbar/Content/styles.module.scss +++ b/src/theme/Navbar/Content/styles.module.scss @@ -207,13 +207,17 @@ Hide color mode toggle in small viewports .sidebarButton.desktop { display: none; } + + .root > div:first-child, + .headerMiddle { + transition: 1s; + } } .root { & > div:first-child, .headerMiddle { opacity: 1; - transition: 1s; visibility: visible; } } diff --git a/src/theme/Navbar/MobileSidebar/Header/index.tsx b/src/theme/Navbar/MobileSidebar/Header/index.tsx new file mode 100644 index 0000000..2698d84 --- /dev/null +++ b/src/theme/Navbar/MobileSidebar/Header/index.tsx @@ -0,0 +1,32 @@ +import { useNavbarMobileSidebar } from '@docusaurus/theme-common/internal' +import { IconArrowLeftCircle } from '@site/src/components/Icon' +import NavbarColorModeToggle from '@theme/Navbar/ColorModeToggle' +import NavbarLogo from '@theme/Navbar/Logo' +import React from 'react' + +function CloseButton() { + const mobileSidebar = useNavbarMobileSidebar() + return ( + + ) +} + +export default function NavbarMobileSidebarHeader(): JSX.Element { + return ( +
+
+ + +
+ +
+ ) +} diff --git a/src/theme/Navbar/MobileSidebar/SecondaryMenu/index.tsx b/src/theme/Navbar/MobileSidebar/SecondaryMenu/index.tsx new file mode 100644 index 0000000..59f35a4 --- /dev/null +++ b/src/theme/Navbar/MobileSidebar/SecondaryMenu/index.tsx @@ -0,0 +1,40 @@ +import React, { type ComponentProps } from 'react' +import { useThemeConfig } from '@docusaurus/theme-common' +import { useNavbarSecondaryMenu } from '@docusaurus/theme-common/internal' +import Translate from '@docusaurus/Translate' +import { ButtonWithIcon } from '@site/src/components/Button/ButtonWithIcon' +import { IconArrowLeftCircle } from '@site/src/components/Icon' +import styles from './styles.module.scss' + +function SecondaryMenuBackButton(props: ComponentProps<'button'>) { + return ( + } + {...props} + > + + Main Menu + + + ) +} + +// The secondary menu slides from the right and shows contextual information +// such as the docs sidebar +export default function NavbarMobileSidebarSecondaryMenu(): JSX.Element | null { + 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} + + ) +} diff --git a/src/theme/Navbar/MobileSidebar/SecondaryMenu/styles.module.scss b/src/theme/Navbar/MobileSidebar/SecondaryMenu/styles.module.scss new file mode 100644 index 0000000..6937a4e --- /dev/null +++ b/src/theme/Navbar/MobileSidebar/SecondaryMenu/styles.module.scss @@ -0,0 +1,18 @@ +.backButton { + & > div { + flex-direction: row-reverse; + + color: #373738; + font-size: 0.875rem; + + svg { + * { + stroke: #909091; + } + } + } + + border: 1px solid #eeeef1; + padding: 12px 18px; + margin-bottom: 8px; +} diff --git a/src/theme/Navbar/index.scss b/src/theme/Navbar/index.scss index 1575746..d00c116 100644 --- a/src/theme/Navbar/index.scss +++ b/src/theme/Navbar/index.scss @@ -11,6 +11,7 @@ --ifm-navbar-padding-vertical: 0.5rem; background: none; + overflow: hidden; } :root {