-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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] Use CSS vars for API pages #41911
Conversation
Netlify deploy previewhttps://deploy-preview-41911--material-ui.netlify.app/ Bundle size reportDetails of bundle changes (Toolpad) |
} | ||
|
||
function ToggleVarTheme(props) { | ||
const { setMode } = useColorScheme(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hook requires to be in a context of a theme with vars otherwise it throws error.
That's the reason why ToggleTheme
is split into 2 components:
- On for the CSS var if feasible
- ANother one without
useColorScheme();
iftheme.vars
is not detected
backgroundColor: theme.vars | ||
? `rgba(${theme.vars.palette.primaryDark[700]} / 0.1)` | ||
: alpha(theme.palette.primaryDark[700], 0.1), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@danilo-leal I did my best to only do technical modifications, but if you can double check the colors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alexfauquette Have you considered dynamic routes or using getLayout()
instead of importing the provider directly to each page?
I don't know much about the differences, that's why I ask.
@alexfauquette @siriwatknp is this PR still relevant? |
Now you can reload an API page in dark mode without having the light mode blinking
🎉
I modified all the API pages at once because they are generated by a script
Those modification leads to an error message in the API pages but I've no idea about why
Can be fixed by this diff, but not sure it's a misusage on our side or an error in the vars support