-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New plugin for classic theme hooks #2636
Comments
Why close this? I agree with this issue. Not all the hooks are generic enough to be shared though, e.g the theme ones which are only useful for a CSS framework supporting dark mode. |
It's because i'm not certain if is really necessary, for example, studying more about bootstrap, they already have some built-in functions that i can use, instead of our hooks. And thinking in other user builtin themes, maybe they also want to build your own logic |
Thinking in the architecture, I'm wondering whats the best place to put this plugin. Current, the plugin abstraction has the responsibility to provide the data for our components, right? But we do this based on some route(from what I saw), for example our docusaurus-plugin-content-docs, provide the data for all docs/* routes, this is what the actions are based on. The theme plugin doesn't seem adequate for the purpose of this issues, because his semantics of to be created for provide components, although i think that since my goal is a plugin for themes, there's more sense define like a theme and export the getThemePath method, e.g. But the semantics sounds weird in both cases, I don't know if is good add other module like hooks? @lex111, since you contribute a lot in the classic components, I would love to know your opinion |
Closing this as it is already implemented. |
💥 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:
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
The text was updated successfully, but these errors were encountered: