mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-13 08:12:48 +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) {
|
||||
const {
|
||||
route: {routes: subroutes},
|
||||
route: {routes: docRoutes},
|
||||
docsMetadata,
|
||||
location,
|
||||
} = props;
|
||||
const currentDocRoute = subroutes.find((subroute) =>
|
||||
matchPath(location.pathname, subroute),
|
||||
const currentDocRoute = docRoutes.find((docRoute) =>
|
||||
matchPath(location.pathname, docRoute),
|
||||
);
|
||||
if (!currentDocRoute) {
|
||||
return <NotFound {...props} />;
|
||||
|
@ -61,7 +62,7 @@ function DocPage(props) {
|
|||
<DocPageContent
|
||||
currentDocRoute={currentDocRoute}
|
||||
docsMetadata={docsMetadata}>
|
||||
{renderRoutes(subroutes)}
|
||||
{renderRoutes(docRoutes)}
|
||||
</DocPageContent>
|
||||
</MDXProvider>
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue