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] Migrate NoSSR demos to emotion #25506

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 3 additions & 12 deletions docs/src/pages/components/no-ssr/FrameDeferring.js
@@ -1,21 +1,12 @@
import * as React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import Box from '@material-ui/core/Box';
import NoSsr from '@material-ui/core/NoSsr';

const useStyles = makeStyles({
container: {
width: 300,
display: 'flex',
flexWrap: 'wrap',
},
});

function LargeTree() {
return Array.from(new Array(5000)).map((_, index) => <span key={index}>.</span>);
}

export default function FrameDeferring() {
const classes = useStyles();
const [state, setState] = React.useState({
open: false,
defer: false,
Expand Down Expand Up @@ -48,7 +39,7 @@ export default function FrameDeferring() {
</button>
<br />
<br />
<div className={classes.container}>
<Box sx={{ width: 300, display: 'flex', flexWrap: 'wrap' }}>
{state.open ? (
<React.Fragment>
<div>Outside NoSsr</div>
Expand All @@ -58,7 +49,7 @@ export default function FrameDeferring() {
</NoSsr>
</React.Fragment>
) : null}
</div>
</Box>
</div>
);
}
15 changes: 3 additions & 12 deletions docs/src/pages/components/no-ssr/FrameDeferring.tsx
@@ -1,21 +1,12 @@
import * as React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import Box from '@material-ui/core/Box';
import NoSsr from '@material-ui/core/NoSsr';

const useStyles = makeStyles({
container: {
width: 300,
display: 'flex',
flexWrap: 'wrap',
},
});

function LargeTree(): any {
return Array.from(new Array(5000)).map((_, index) => <span key={index}>.</span>);
}

export default function FrameDeferring() {
const classes = useStyles();
const [state, setState] = React.useState({
open: false,
defer: false,
Expand Down Expand Up @@ -48,7 +39,7 @@ export default function FrameDeferring() {
</button>
<br />
<br />
<div className={classes.container}>
<Box sx={{ width: 300, display: 'flex', flexWrap: 'wrap' }}>
{state.open ? (
<React.Fragment>
<div>Outside NoSsr</div>
Expand All @@ -58,7 +49,7 @@ export default function FrameDeferring() {
</NoSsr>
</React.Fragment>
) : null}
</div>
</Box>
</div>
);
}
6 changes: 1 addition & 5 deletions docs/src/pages/components/no-ssr/SimpleNoSsr.js
Expand Up @@ -10,11 +10,7 @@ export default function SimpleNoSsr() {
</Box>
<NoSsr>
<Box
sx={{
p: 2,
bgcolor: 'secondary.main',
color: 'primary.contrastText',
}}
sx={{ p: 2, bgcolor: 'secondary.main', color: 'secondary.contrastText' }}
>
Client only
</Box>
Expand Down
6 changes: 1 addition & 5 deletions docs/src/pages/components/no-ssr/SimpleNoSsr.tsx
Expand Up @@ -10,11 +10,7 @@ export default function SimpleNoSsr() {
</Box>
<NoSsr>
<Box
sx={{
p: 2,
bgcolor: 'secondary.main',
color: 'primary.contrastText',
}}
sx={{ p: 2, bgcolor: 'secondary.main', color: 'secondary.contrastText' }}
>
Client only
</Box>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/no-ssr/no-ssr.md
Expand Up @@ -17,7 +17,7 @@ This component can be useful in a variety of situations:

{{"component": "modules/components/ComponentLinkHeader.js", "design": false}}

## Client side deferring
## Client-side deferring

{{"demo": "pages/components/no-ssr/SimpleNoSsr.js"}}

Expand Down