[docs] Fix theme switcher in docs demos#4864
[docs] Fix theme switcher in docs demos#4864apedroferreira merged 17 commits intomui:masterfrom apedroferreira:fix-theme-switcher-docs
Conversation
docs/data/toolpad/core/components/dashboard-layout/DashboardLayoutBasic.js
Outdated
Show resolved
Hide resolved
Netlify deploy preview |
|
Does it make sense to show a warning/error in the console/screen when the |
Sounds good, just added it. |
|
As discussed: we can merge this but a future alternative (very soon ideally) to get rid of this clutter in the demos would be to add a new attribute to documentation demos in MUI infra to set this up for us without showing it to the user. |
Since the update to MUI v7, the theme switcher in all demos seems to be broken: https://mui.com/toolpad/core/react-dashboard-layout/
I think I've identified the problem as we need to set a
containerbased on theiframewindow in the Emotion cache being used.Added a new
DemoProvidercomponent thats needs to wrap each demo that uses a full application with theme switching. A more hidden alternative could be to again use some specific docs context for this. Not sure which is better...https://deploy-preview-4864--mui-toolpad-docs.netlify.app/toolpad/core/react-dashboard-layout/#demo