mirror of
https://github.com/facebook/docusaurus.git
synced 2025-12-26 01:33:02 +00:00
feat: new route props
This commit is contained in:
parent
52bf244c97
commit
c7cbafc88c
|
|
@ -52,7 +52,6 @@ export default async function pluginContentShowcase(
|
|||
return {
|
||||
name: 'docusaurus-plugin-content-showcase',
|
||||
|
||||
// TODO doesn't work
|
||||
getPathsToWatch() {
|
||||
return getContentPathList(contentPaths).flatMap((contentPath) =>
|
||||
include.map((pattern) => `${contentPath}/${pattern}`),
|
||||
|
|
@ -74,18 +73,15 @@ export default async function pluginContentShowcase(
|
|||
});
|
||||
},
|
||||
|
||||
async contentLoaded({content, actions}) {
|
||||
async contentLoaded({content, actions: {addRoute}}) {
|
||||
if (!content) {
|
||||
return;
|
||||
}
|
||||
|
||||
const {addRoute, createData} = actions;
|
||||
|
||||
await processContentLoaded({
|
||||
content,
|
||||
routeBasePath,
|
||||
addRoute,
|
||||
createData,
|
||||
});
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -12,23 +12,16 @@ export async function processContentLoaded({
|
|||
content,
|
||||
routeBasePath,
|
||||
addRoute,
|
||||
createData,
|
||||
}: {
|
||||
content: ShowcaseItems;
|
||||
routeBasePath: string;
|
||||
addRoute: PluginContentLoadedActions['addRoute'];
|
||||
createData: PluginContentLoadedActions['createData'];
|
||||
}): Promise<void> {
|
||||
const showcaseAllData = await createData(
|
||||
'showcaseAll.json',
|
||||
JSON.stringify(content.items),
|
||||
);
|
||||
|
||||
addRoute({
|
||||
path: routeBasePath,
|
||||
component: '@theme/Showcase',
|
||||
modules: {
|
||||
content: showcaseAllData,
|
||||
props: {
|
||||
items: content.items,
|
||||
},
|
||||
exact: true,
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue