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

[docs] Fix Theme nesting demo in codesandbox #12097

Merged
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
12 changes: 6 additions & 6 deletions docs/src/pages/customization/css-in-js/JssRegistry.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@ class JssRegistry extends React.Component {

render() {
return (
<JssProvider registry={sheetsRegistry}>
<MuiThemeProvider theme={theme}>
<div>
<div>
<JssProvider registry={sheetsRegistry}>
<MuiThemeProvider theme={theme}>
<CssInJs />
<br />
{'We are collecting all the sheets injected in the DOM.'}
<br />
{`The size of the registry is ${this.state.length}.`}
</div>
</MuiThemeProvider>
</JssProvider>
</MuiThemeProvider>
</JssProvider>
</div>
);
}
}
Expand Down
14 changes: 7 additions & 7 deletions docs/src/pages/customization/overrides/DynamicThemeNesting.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import React from 'react';
import Button from '@material-ui/core/Button';
import { MuiThemeProvider } from '@material-ui/core/styles';
import { createMuiTheme, MuiThemeProvider } from '@material-ui/core/styles';
import FormControlLabel from '@material-ui/core/FormControlLabel';
import blue from '@material-ui/core/colors/blue';
import Switch from '@material-ui/core/Switch';

const defaultTheme = createMuiTheme();

class DynamicThemeNesting extends React.Component {
state = {
color: 'default',
Expand All @@ -29,21 +31,19 @@ class DynamicThemeNesting extends React.Component {
label="Blue"
/>
<MuiThemeProvider
theme={theme =>
theme={
this.state.color === 'blue'
? {
...theme,
...defaultTheme,
palette: {
...theme.palette,
...defaultTheme.palette,
secondary: {
light: blue[300],
main: blue[500],
dark: blue[700],
contrastText: '#fff',
},
},
}
: theme
: defaultTheme
}
>
<Button variant="raised" color="secondary">
Expand Down
14 changes: 6 additions & 8 deletions docs/src/pages/customization/themes/Nested.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,13 @@ const theme3 = outerTheme => ({
function Nested() {
return (
<MuiThemeProvider theme={theme1}>
<div>
<NestedCheckbox />
<MuiThemeProvider theme={theme2}>
<NestedCheckbox />
<MuiThemeProvider theme={theme2}>
<NestedCheckbox />
</MuiThemeProvider>
<MuiThemeProvider theme={theme3}>
<NestedCheckbox />
</MuiThemeProvider>
</div>
</MuiThemeProvider>
<MuiThemeProvider theme={theme3}>
<NestedCheckbox />
</MuiThemeProvider>
</MuiThemeProvider>
);
}
Expand Down
6 changes: 2 additions & 4 deletions docs/src/pages/customization/themes/Palette.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ const theme = createMuiTheme({
function Palette() {
return (
<MuiThemeProvider theme={theme}>
<div>
<Button color="primary">Primary</Button>
<Button color="secondary">Secondary</Button>
</div>
<Button color="primary">Primary</Button>
<Button color="secondary">Secondary</Button>
</MuiThemeProvider>
);
}
Expand Down
1 change: 0 additions & 1 deletion packages/material-ui/src/styles/MuiThemeProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ class MuiThemeProvider extends React.Component {
'Material-UI: you are providing a theme function property ' +
'to the MuiThemeProvider component:',
'<MuiThemeProvider theme={outerTheme => outerTheme} />',
'',
'However, no outer theme is present.',
'Make sure a theme is already injected higher in the React tree ' +
'or provide a theme object.',
Expand Down