Skip to content

Commit a8cd858

Browse files
[core] Batch small changes (#18780)
1 parent ae4f626 commit a8cd858

File tree

20 files changed

+144
-32
lines changed

20 files changed

+144
-32
lines changed

docs/pages/api/backdrop.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,7 @@ You can override the style of the component thanks to one of these customization
5252

5353
If that's not sufficient, you can check the [implementation of the component](https://github.com/mui-org/material-ui/blob/master/packages/material-ui/src/Backdrop/Backdrop.js) for more detail.
5454

55+
## Demos
56+
57+
- [Backdrop](/components/backdrop/)
58+

docs/pages/components/backdrop.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React from 'react';
2+
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs';
3+
4+
const req = require.context('docs/src/pages/components/backdrop', false, /\.(md|js|tsx)$/);
5+
const reqSource = require.context(
6+
'!raw-loader!../../src/pages/components/backdrop',
7+
false,
8+
/\.(js|tsx)$/,
9+
);
10+
const reqPrefix = 'pages/components/backdrop';
11+
12+
export default function Page() {
13+
return <MarkdownDocs req={req} reqSource={reqSource} reqPrefix={reqPrefix} />;
14+
}

docs/src/modules/components/Ad.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,13 @@ const inHouseAds = [
7575
img: '/static/in-house/monday.jpg',
7676
description: 'Why use multiple tools to manage your projects? Meet monday.com',
7777
},
78+
{
79+
name: 'bonsaiilabs',
80+
link: 'https://bonsaiilabs.com/courseDetail/material-ui-with-react',
81+
img: '/static/in-house/bonsaiilabs.png',
82+
description:
83+
'A course to learn Material‑UI while developing a mobile flight search and booking app.',
84+
},
7885
];
7986

8087
function Ad(props) {
@@ -165,7 +172,7 @@ function Ad(props) {
165172
if (carbonOut || codeFundOut) {
166173
children = <AdInHouse ad={inHouseAds[Math.floor(inHouseAds.length * random)]} />;
167174
minHeight = 'auto';
168-
} else if (random >= 0.55) {
175+
} else if (random >= 0.65) {
169176
children = <AdCodeFund />;
170177
} else {
171178
children = <AdCarbon />;

docs/src/modules/components/AppFrame.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,6 @@ const styles = theme => ({
110110
color: theme.palette.type === 'dark' ? '#fff' : null,
111111
backgroundColor: theme.palette.type === 'dark' ? theme.palette.background.level2 : null,
112112
transition: theme.transitions.create('width'),
113-
'@media print': {
114-
position: 'absolute',
115-
},
116113
},
117114
language: {
118115
margin: theme.spacing(0, 0.5, 0, 1),

docs/src/modules/components/MarkdownElement.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ const styles = theme => ({
126126
'& pre': {
127127
margin: '24px 0',
128128
padding: '12px 18px',
129-
backgroundColor: '#333',
129+
backgroundColor: '#272c34',
130130
direction: 'ltr',
131131
borderRadius: theme.shape.borderRadius,
132132
overflow: 'auto',
@@ -144,7 +144,7 @@ const styles = theme => ({
144144
borderRadius: 2,
145145
},
146146
'& code[class*="language-"]': {
147-
backgroundColor: '#333',
147+
backgroundColor: '#272c34',
148148
color: '#fff',
149149
},
150150
'& p code, & ul code, & pre code': {

docs/src/modules/redux/initRedux.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function create(initialState) {
2121
process.browser &&
2222
!window.__REDUX_DEVTOOLS_EXTENSION__ &&
2323
// redux-logger needs this feature
24-
Object['assign'] // eslint-disable-line dot-notation
24+
Object.hasOwnProperty('assign')
2525
) {
2626
// eslint-disable-next-line global-require
2727
const createLogger = require('redux-logger').createLogger;

docs/src/pages.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ const pages = [
7474
{ pathname: '/components/progress' },
7575
{ pathname: '/components/dialogs' },
7676
{ pathname: '/components/snackbars' },
77+
{ pathname: '/components/backdrop' },
7778
],
7879
},
7980
{
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import React from 'react';
2+
import Backdrop from '@material-ui/core/Backdrop';
3+
import CircularProgress from '@material-ui/core/CircularProgress';
4+
import { makeStyles } from '@material-ui/core/styles';
5+
6+
const useStyles = makeStyles(theme => ({
7+
backdrop: {
8+
zIndex: theme.zIndex.drawer + 1,
9+
color: '#fff',
10+
},
11+
}));
12+
13+
export default function SimpleBackdrop() {
14+
const classes = useStyles();
15+
const [open, setOpen] = React.useState(false);
16+
17+
return (
18+
<div>
19+
<button
20+
type="button"
21+
onClick={() => {
22+
setOpen(!open);
23+
}}
24+
>
25+
Show backdrop
26+
</button>
27+
<Backdrop
28+
className={classes.backdrop}
29+
open={open}
30+
onClick={() => {
31+
setOpen(false);
32+
}}
33+
>
34+
<CircularProgress color="inherit" />
35+
</Backdrop>
36+
</div>
37+
);
38+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import React from 'react';
2+
import Backdrop from '@material-ui/core/Backdrop';
3+
import CircularProgress from '@material-ui/core/CircularProgress';
4+
import { makeStyles, createStyles, Theme } from '@material-ui/core/styles';
5+
6+
const useStyles = makeStyles((theme: Theme) =>
7+
createStyles({
8+
backdrop: {
9+
zIndex: theme.zIndex.drawer + 1,
10+
color: '#fff',
11+
},
12+
}),
13+
);
14+
15+
export default function SimpleBackdrop() {
16+
const classes = useStyles();
17+
const [open, setOpen] = React.useState(false);
18+
19+
return (
20+
<div>
21+
<button
22+
type="button"
23+
onClick={() => {
24+
setOpen(!open);
25+
}}
26+
>
27+
Show backdrop
28+
</button>
29+
<Backdrop
30+
className={classes.backdrop}
31+
open={open}
32+
onClick={() => {
33+
setOpen(false);
34+
}}
35+
>
36+
<CircularProgress color="inherit" />
37+
</Backdrop>
38+
</div>
39+
);
40+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
title: Overlay React component
3+
components: Backdrop
4+
---
5+
6+
# Backdrop
7+
8+
<p class="description">The backdrop component is used to provide emphasis on a particular element or parts of it.</p>
9+
10+
The overlay signals to the user of a state change within the application and can be used for creating loaders, dialogs and more.
11+
In its simplest form, the backdrop component will add a dimmed layer over your application.
12+
13+
{{"demo": "pages/components/backdrop/SimpleBackdrop.js"}}

0 commit comments

Comments
 (0)