mirror of
https://github.com/Snigdha-OS/documentation.git
synced 2025-09-15 20:34:56 +02:00
59 lines
1.6 KiB
JavaScript
59 lines
1.6 KiB
JavaScript
/**
|
|
* 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 from 'react';
|
|
import clsx from 'clsx';
|
|
import {useThemeConfig} from '@docusaurus/theme-common';
|
|
import {
|
|
useHideableNavbar,
|
|
useNavbarMobileSidebar,
|
|
} from '@docusaurus/theme-common/internal';
|
|
import {translate} from '@docusaurus/Translate';
|
|
import NavbarMobileSidebar from '@theme/Navbar/MobileSidebar';
|
|
import styles from './styles.module.css';
|
|
function NavbarBackdrop(props) {
|
|
return (
|
|
<div
|
|
role="presentation"
|
|
{...props}
|
|
className={clsx('navbar-sidebar__backdrop', props.className)}
|
|
/>
|
|
);
|
|
}
|
|
export default function NavbarLayout({children}) {
|
|
const {
|
|
navbar: {hideOnScroll, style},
|
|
} = useThemeConfig();
|
|
const mobileSidebar = useNavbarMobileSidebar();
|
|
const {navbarRef, isNavbarVisible} = useHideableNavbar(hideOnScroll);
|
|
return (
|
|
<nav
|
|
ref={navbarRef}
|
|
aria-label={translate({
|
|
id: 'theme.NavBar.navAriaLabel',
|
|
message: 'Main',
|
|
description: 'The ARIA label for the main navigation',
|
|
})}
|
|
className={clsx(
|
|
'navbar',
|
|
'navbar--fixed-top',
|
|
hideOnScroll && [
|
|
styles.navbarHideable,
|
|
!isNavbarVisible && styles.navbarHidden,
|
|
],
|
|
{
|
|
'navbar--dark': style === 'dark',
|
|
'navbar--primary': style === 'primary',
|
|
'navbar-sidebar--show': mobileSidebar.shown,
|
|
},
|
|
)}>
|
|
{children}
|
|
<NavbarBackdrop onClick={mobileSidebar.toggle} />
|
|
<NavbarMobileSidebar />
|
|
</nav>
|
|
);
|
|
}
|