Skip to content
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

[system][docs] Fix link to createCssVarsProvider #43661

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CHANGELOG.old.md
Original file line number Diff line number Diff line change
Expand Up @@ -4127,8 +4127,8 @@ A big thanks to the 17 contributors who made this release possible. Here are som

```diff
import {
unstable_createCssVarsProvider as createCssVarsProvider,
+ unstable_createCssVarsTheme as createCssVarsTheme,
unstable_createCssVarsProvider as createCssVarsProvider,
+ unstable_createCssVarsTheme as createCssVarsTheme,
} from '@mui/system';

const { CssVarsProvider } = createCssVarsProvider({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ Now, the Button's `backgroundColor`, `borderColor` and text `color` values will
For framework- or language-specific setup instructions, see [CSS theme variables—Usage—Server-side rendering](/material-ui/customization/css-theme-variables/usage/).
For framework or language specific setup, see [this](/material-ui/customization/css-theme-variables/usage/)

See the complete usage of `createCssVarsProvider` in [Material UI](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/styles/CssVarsProvider.tsx) and [Joy UI](https://github.com/mui/material-ui/blob/master/packages/mui-joy/src/styles/CssVarsProvider.tsx).
See the complete usage of `createCssVarsProvider` in [Material UI](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/styles/ThemeProviderWithVars.tsx) and [Joy UI](https://github.com/mui/material-ui/blob/master/packages/mui-joy/src/styles/CssVarsProvider.tsx).

## API

Expand Down
22 changes: 12 additions & 10 deletions packages/mui-material/src/styles/ThemeProviderWithVars.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,19 @@ let warnedOnce = false;
// TODO: remove in v7
// eslint-disable-next-line @typescript-eslint/naming-convention
function Experimental_CssVarsProvider(props: any) {
if (!warnedOnce) {
console.warn(
[
'MUI: The Experimental_CssVarsProvider component has been ported into ThemeProvider.',
'',
"You should use `import { ThemeProvider } from '@mui/material/styles'` instead.",
'For more details, check out https://mui.com/material-ui/customization/css-theme-variables/usage/',
].join('\n'),
);
if (process.env.NODE_ENV !== 'production') {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (!warnedOnce) {
console.warn(
[
'MUI: The Experimental_CssVarsProvider component has been ported into ThemeProvider.',
'',
"You should use `import { ThemeProvider } from '@mui/material/styles'` instead.",
'For more details, check out https://mui.com/material-ui/customization/css-theme-variables/usage/',
].join('\n'),
);

warnedOnce = true;
warnedOnce = true;
}
}

return <InternalCssVarsProvider {...props} />;
Expand Down
Loading