aboutsummaryrefslogtreecommitdiff
path: root/front/odiparpack/app/containers/Layouts/demos/Breakpoint.js
blob: be557b43fe50afc944b6ff2c96f8309a7435699a (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
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 (
    <div className={classes.root}>
      {/* Breakpoin up block */}
      <Typography variant="h5">Breakpoint up</Typography>
      <Typography gutterBottom noWrap>
        Using any breakpoint up property, the given children will be hidden at or above the breakpoint.
      </Typography>
      <div className={classes.container}>
        <Hidden xsUp>
          <Paper className={classes.paper}>xsUp</Paper>
        </Hidden>
        <Hidden smUp>
          <Paper className={classes.paper}>smUp</Paper>
        </Hidden>
        <Hidden mdUp>
          <Paper className={classes.paper}>mdUp</Paper>
        </Hidden>
        <Hidden lgUp>
          <Paper className={classes.paper}>lgUp</Paper>
        </Hidden>
        <Hidden xlUp>
          <Paper className={classes.paper}>xlUp</Paper>
        </Hidden>
      </div>
      <Typography variant="caption" gutterBottom align="center">
Current width:
        {props.width}
      </Typography>
      <Divider className={classes.divider} />
      {/* Breakpoin down block */}
      <Typography variant="h5">Breakpoint down</Typography>
      <Typography gutterBottom noWrap>
        Using any breakpoint down property, the given children will be hidden at or below the breakpoint.
      </Typography>
      <div className={classes.container}>
        <Hidden xsDown>
          <Paper className={classes.paper}>xsDown</Paper>
        </Hidden>
        <Hidden smDown>
          <Paper className={classes.paper}>smDown</Paper>
        </Hidden>
        <Hidden mdDown>
          <Paper className={classes.paper}>mdDown</Paper>
        </Hidden>
        <Hidden lgDown>
          <Paper className={classes.paper}>lgDown</Paper>
        </Hidden>
        <Hidden xlDown>
          <Paper className={classes.paper}>xlDown</Paper>
        </Hidden>
      </div>
      <Typography variant="caption" gutterBottom align="center">
Current width:
        {props.width}
      </Typography>
      <Divider className={classes.divider} />
      {/* Breakpoin only block */}
      <Typography variant="h5">Breakpoint only</Typography>
      <Typography gutterBottom noWrap>
        Using the breakpoint only property, the given children will be hidden at the specified breakpoint(s).
      </Typography>
      <div className={classes.container}>
        <Hidden only="lg">
          <Paper className={classes.paper}>Hidden on lg</Paper>
        </Hidden>
        <Hidden only="sm">
          <Paper className={classes.paper}>Hidden on sm</Paper>
        </Hidden>
        <Hidden only={['sm', 'lg']}>
          <Paper className={classes.paper}>Hidden on sm and lg</Paper>
        </Hidden>
      </div>
      <Typography variant="caption" gutterBottom align="center">
Current width:
        {props.width}
      </Typography>
    </div>
  );
}

Breakpoint.propTypes = {
  classes: PropTypes.object.isRequired,
  width: PropTypes.string.isRequired,
};

export default compose(withStyles(styles), withWidth())(Breakpoint);