blob: 89de6fc38f77eaaa4e026c38f3a479e4e957c7a9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
import React from 'react';
import PropTypes from 'prop-types';
import { withStyles } from '@material-ui/core/styles';
import { red, green, indigo as blue } from '@material-ui/core/colors';
import { Typography } from '@material-ui/core';
const styles = theme => ({
root: {
padding: theme.spacing(1),
'& h3': {
color: theme.palette.common.white,
},
[theme.breakpoints.down('sm')]: {
backgroundColor: red[500],
},
[theme.breakpoints.up('md')]: {
backgroundColor: blue[500],
},
[theme.breakpoints.up('lg')]: {
backgroundColor: green[500],
},
},
});
function MediaQuery(props) {
const { classes } = props;
return (
<div className={classes.root}>
<Typography variant="subtitle1">down(sm): red</Typography>
<Typography variant="subtitle1">up(md): blue</Typography>
<Typography variant="subtitle1">up(lg): green</Typography>
</div>
);
}
MediaQuery.propTypes = {
classes: PropTypes.object.isRequired,
};
export default withStyles(styles)(MediaQuery);
|