import React from 'react'; import PropTypes from 'prop-types'; import compose from 'recompose/compose'; import { withStyles } from '@material-ui/core/styles'; import { Paper, Hidden, Divider, withWidth, Typography } from '@material-ui/core'; const styles = theme => ({ root: { flexGrow: 1, }, container: { display: 'flex', }, paper: { padding: theme.spacing(2), textAlign: 'center', color: theme.palette.text.secondary, flex: '1 0 auto', margin: theme.spacing(1), }, divider: { display: 'block', margin: `${theme.spacing(3)}px 0`, } }); function Breakpoint(props) { const { classes } = props; return (
{/* Breakpoin up block */} Breakpoint up Using any breakpoint up property, the given children will be hidden at or above the breakpoint.
xsUp smUp mdUp lgUp xlUp
Current width: {props.width} {/* Breakpoin down block */} Breakpoint down Using any breakpoint down property, the given children will be hidden at or below the breakpoint.
xsDown smDown mdDown lgDown xlDown
Current width: {props.width} {/* Breakpoin only block */} Breakpoint only Using the breakpoint only property, the given children will be hidden at the specified breakpoint(s).
Hidden on lg Hidden on sm Hidden on sm and lg
Current width: {props.width}
); } Breakpoint.propTypes = { classes: PropTypes.object.isRequired, width: PropTypes.string.isRequired, }; export default compose(withStyles(styles), withWidth())(Breakpoint);