-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Description
💥 Proposal
Context
A few days ago, I started to build another theme to docusaurus, since we already have a good separation of concerns, I didn't have many problems to develop my components using the data provided by the @docusaurus/plugin-content-blog(Until now, I only created the blog components). This week I'm working in layout components, like: footer, navbar and etc. and because this, I needed to use some data provided by our classic theme custom hooks.
So, What I Did? I copied-paste the classic theme hooks to my bootstrap theme, we know that isn't sustainable and scalable copy-paste the classic theme hooks, but before I refactor anything, I want to know which things are considered advantages in this model, beyond the fact of the isolation for the classic module, and also get feedback about my ideas.
Design proposed
From our doc, we say:
"Themes are for providing UI components to present the content. Most content plugins need to be paired with a theme in order to be actually useful. The UI is a separate layer from the data schema, so it makes it easy to swap out the themes for other designs (i.e., Bootstrap)."
I loved this description, and yes, it's true, for contents, like, blog, docs, or things related to pages, we can use @docusaurus/plugin-content-docs, or @docusaurus/plugin-content-blog. My point here is: is it possible to reply the same for the layout things, like, scroll, tab group, logo and etc.. if you take a look in the hooks you'll see this:
| useHideableNavbar.js
| useLocationHash.js
| useLockBodyScroll.js
| useLogo.js
| useTOCHighlight.js
| useTabGroupChoice.js
| useTabGroupChoiceContext.js
| useTheme.js
| useThemeContext.js
Why not expose these data across all theme sources using our plugin system?
Something like @docusaurus/plugin-theme-layout-hooks or @docusaurus/plugin-content-theme
The content of the hooks, don't have the goal to be modified but shared with all themes, that
perhaps we will use.
DISCLAIMER: If this would be accepted, and can be more complex than expected, we probably would like to make the things in an incremental and focused way. But from what I saw, the only module that has a dependency with the hooks, is the classic theme.
Have you read the Contributing Guidelines on issues?
yep