docs: update layout so it can handle navbar function smoothly
This commit is contained in:
parent
afd3cb95b8
commit
16bbd9e52b
@ -14,6 +14,11 @@ import Footer from "@site/src/containers/Footer";
|
|||||||
import LayoutProvider from "@theme/Layout/Provider";
|
import LayoutProvider from "@theme/Layout/Provider";
|
||||||
import ErrorPageContent from "@theme/ErrorPageContent";
|
import ErrorPageContent from "@theme/ErrorPageContent";
|
||||||
import styles from "./styles.module.scss";
|
import styles from "./styles.module.scss";
|
||||||
|
import NavBarExtension from "../NavbarExtension";
|
||||||
|
import { useLocation } from "react-router-dom";
|
||||||
|
|
||||||
|
const allowedPaths = ["/docs/", "/developer/", "/api-reference/", "/guides/", "/guides", "/docs", "/developer", "/api-reference", "/guides/changelog"];
|
||||||
|
|
||||||
export default function Layout(props) {
|
export default function Layout(props) {
|
||||||
const {
|
const {
|
||||||
children,
|
children,
|
||||||
@ -24,6 +29,10 @@ export default function Layout(props) {
|
|||||||
description,
|
description,
|
||||||
} = props;
|
} = props;
|
||||||
useKeyboardNavigation();
|
useKeyboardNavigation();
|
||||||
|
|
||||||
|
const location = useLocation();
|
||||||
|
|
||||||
|
const isAllowedPath = allowedPaths.includes(location.pathname);
|
||||||
return (
|
return (
|
||||||
<LayoutProvider>
|
<LayoutProvider>
|
||||||
<PageMetadata title={title} description={description} />
|
<PageMetadata title={title} description={description} />
|
||||||
@ -32,14 +41,20 @@ export default function Layout(props) {
|
|||||||
|
|
||||||
<AnnouncementBar />
|
<AnnouncementBar />
|
||||||
|
|
||||||
<Navbar />
|
<Navbar/>
|
||||||
|
|
||||||
|
{isAllowedPath ? <NavBarExtension /> : ""}
|
||||||
|
|
||||||
|
{/* {console.log("Is allowed path?", location.pathname)} */}
|
||||||
|
|
||||||
|
|
||||||
<div
|
<div
|
||||||
id={SkipToContentFallbackId}
|
id={SkipToContentFallbackId}
|
||||||
className={clsx(
|
className={clsx(
|
||||||
ThemeClassNames.wrapper.main,
|
ThemeClassNames.wrapper.main,
|
||||||
styles.mainWrapper,
|
styles.mainWrapper,
|
||||||
wrapperClassName
|
wrapperClassName,
|
||||||
|
isAllowedPath && "mt-0 md:mt-11"
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<ErrorBoundary fallback={(params) => <ErrorPageContent {...params} />}>
|
<ErrorBoundary fallback={(params) => <ErrorPageContent {...params} />}>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user