UNPKG

@activelylearn/material-ui

Version:

Material-UI's workspace package

39 lines (33 loc) 933 B
import React from 'react'; import PropTypes from 'prop-types'; import compose from 'recompose/compose'; import { withStyles } from '@material-ui/core/styles'; import withWidth from '@material-ui/core/withWidth'; import Typography from '@material-ui/core/Typography'; const styles = theme => ({ root: { padding: theme.spacing.unit, [theme.breakpoints.up('md')]: { backgroundColor: theme.palette.primary.main, }, [theme.breakpoints.down('sm')]: { backgroundColor: theme.palette.secondary.main, }, }, }); function MediaQuery(props) { const { classes } = props; return ( <div className={classes.root}> <Typography variant="subheading">{`Current width: ${props.width}`}</Typography> </div> ); } MediaQuery.propTypes = { classes: PropTypes.object.isRequired, width: PropTypes.string.isRequired, }; export default compose( withStyles(styles), withWidth(), )(MediaQuery);