mirror of
https://github.com/Snigdha-OS/documentation.git
synced 2025-09-14 20:24:56 +02:00
32 lines
1.2 KiB
JavaScript
32 lines
1.2 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 {HtmlClassNameProvider, ThemeClassNames} from '@docusaurus/theme-common';
|
|
import {
|
|
DocsSidebarProvider,
|
|
useDocRootMetadata,
|
|
} from '@docusaurus/theme-common/internal';
|
|
import DocRootLayout from '@theme/DocRoot/Layout';
|
|
import NotFoundContent from '@theme/NotFound/Content';
|
|
export default function DocRoot(props) {
|
|
const currentDocRouteMetadata = useDocRootMetadata(props);
|
|
if (!currentDocRouteMetadata) {
|
|
// We only render the not found content to avoid a double layout
|
|
// see https://github.com/facebook/docusaurus/pull/7966#pullrequestreview-1077276692
|
|
return <NotFoundContent />;
|
|
}
|
|
const {docElement, sidebarName, sidebarItems} = currentDocRouteMetadata;
|
|
return (
|
|
<HtmlClassNameProvider className={clsx(ThemeClassNames.page.docsDocPage)}>
|
|
<DocsSidebarProvider name={sidebarName} items={sidebarItems}>
|
|
<DocRootLayout>{docElement}</DocRootLayout>
|
|
</DocsSidebarProvider>
|
|
</HtmlClassNameProvider>
|
|
);
|
|
}
|