mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-15 01:02:35 +02:00
doc components initial simplification
This commit is contained in:
parent
ad5918eb5c
commit
f657b4c4ae
1 changed files with 5 additions and 4 deletions
|
@ -44,14 +44,15 @@ function DocPageContent({currentDocRoute, docsMetadata, children}) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO can this be abstracted into the plugin instead of the theme?
|
||||||
function DocPage(props) {
|
function DocPage(props) {
|
||||||
const {
|
const {
|
||||||
route: {routes: subroutes},
|
route: {routes: docRoutes},
|
||||||
docsMetadata,
|
docsMetadata,
|
||||||
location,
|
location,
|
||||||
} = props;
|
} = props;
|
||||||
const currentDocRoute = subroutes.find((subroute) =>
|
const currentDocRoute = docRoutes.find((docRoute) =>
|
||||||
matchPath(location.pathname, subroute),
|
matchPath(location.pathname, docRoute),
|
||||||
);
|
);
|
||||||
if (!currentDocRoute) {
|
if (!currentDocRoute) {
|
||||||
return <NotFound {...props} />;
|
return <NotFound {...props} />;
|
||||||
|
@ -61,7 +62,7 @@ function DocPage(props) {
|
||||||
<DocPageContent
|
<DocPageContent
|
||||||
currentDocRoute={currentDocRoute}
|
currentDocRoute={currentDocRoute}
|
||||||
docsMetadata={docsMetadata}>
|
docsMetadata={docsMetadata}>
|
||||||
{renderRoutes(subroutes)}
|
{renderRoutes(docRoutes)}
|
||||||
</DocPageContent>
|
</DocPageContent>
|
||||||
</MDXProvider>
|
</MDXProvider>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue