-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[docs-infra] Support shared source between demos #38911
Comments
Charts use caseCurrently, charts face a tradeoff between:
Would be nice to be able to split the demonstration into two files: In a perfect world, those data file would not be duplicated. Like the data grid curretnly has 2 dataset used every where (comodity and employes) I could build data set like: |
Yeah, the same as Olivier described up there with the Autocomplete component. Another similar use case, again with Base UI, is having the same styles file shared across multiple demos. That way, we'd only need to maintain one file and not multiple as we do today. π€ I've removed the Base UI reference from the title and the label to make this issue a broader problem β not just something we want to do for one product only. There already are cases where Material UI and the MUI X components would benefit. |
For the Pickers documentation, we have a few cases where this could really benefit the readability and code reusability.
|
I have forked a bit the problem into two:
|
What's the problem? π€
This is a continuation of #36498, mui/mui-x#10197, and #37222.
If we take https://mui.com/base-ui/react-button/ as an example, we duplicate a lot of code between each demo.
What are the requirements? β
What are our options? π‘
Proposed solution π’
What if we could share the same component source between many demos? We could have a shared source of truth, one that encapsulates the component logic, and then have the demos use them where relevant.
Demo https://mui.com/base-ui/react-button/#introduction would look something like this:
The Button would be defined in another tab
With these shared demos, we could at a later point in time create a CLI to allow developers to copy its source directly to their filesystem.
In the same way, we could update https://mui.com/material-ui/react-autocomplete/#combo-box to have datasets stored in a different tab. When using the general copy (not the local one) button, it should automatically concatenate the sources if the file type are compatible (.ts + .ts: yes, .ts + .css: no)
Resources and benchmarks π
The text was updated successfully, but these errors were encountered: