docusaurus-plugin-react-docgen-typescript icon indicating copy to clipboard operation
docusaurus-plugin-react-docgen-typescript copied to clipboard

Auto-generate routes for components

Open fsmaia opened this issue 3 years ago • 7 comments

Fixes #5.

I set an addRoute to create a route for each component, plus an index route.

These routes are wrapped by some layout components:

  • ReactDocLayout, which is basically a simplified copy of DocPageContent, that adds the navbar and a custom sidebar (I was unable to embed the routes into the existing sidebar automatically)
  • ReactComponentPage, which is the root route, calling the layout and rendering the children properly
  • ReactComponentItem, which is the component docs itself

The user can enable this behavior with a createRoutes flag, and also set a baseRoute route, in which the routes/links will be created.

fsmaia avatar Dec 07 '21 23:12 fsmaia

Some screenshots of a local execution: React docs home page: image

React component docs: image

fsmaia avatar Dec 08 '21 06:12 fsmaia

@atomicpages, could you help me on how to proceed with global or route flags? I implemented the createRoutes behavior only on the else branch (no global and no route).

fsmaia avatar Dec 08 '21 06:12 fsmaia

Hello there! I saw this MR and it's exactly what I need to document an SDK that my team is working on.

Are there any plans on merging this one?

tsironis avatar Mar 14 '22 14:03 tsironis

cc @atomicpages

fsmaia avatar Mar 15 '22 13:03 fsmaia

👋 howdy, I'll dig into this more later in the week

atomicpages avatar Mar 16 '22 19:03 atomicpages

I think this PR deserve a merge :+1:

molanostephane avatar Aug 17 '22 17:08 molanostephane