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
|
import React from 'react';
import PropTypes from 'prop-types';
import { withStyles } from '@material-ui/core/styles';
import { Typography, Paper, Divider, Grid } from '@material-ui/core';
const styles = theme => ({
container: {
display: 'grid',
gridTemplateColumns: 'repeat(12, 1fr)',
gridGap: `${theme.spacing(3)}px`,
},
paper: {
padding: theme.spacing(1),
textAlign: 'center',
color: theme.palette.text.secondary,
whiteSpace: 'nowrap',
marginBottom: theme.spacing(1),
backgroundColor: theme.palette.secondary.light,
},
divider: {
margin: `${theme.spacing(2)}px 0`,
},
});
function CSSGrid(props) {
const { classes } = props;
return (
<div>
<Typography variant="subtitle1" gutterBottom>
Material-UI Grid:
</Typography>
<Grid container spacing={3}>
<Grid item xs={3}>
<Paper className={classes.paper}>xs=3</Paper>
</Grid>
<Grid item xs={3}>
<Paper className={classes.paper}>xs=3</Paper>
</Grid>
<Grid item xs={3}>
<Paper className={classes.paper}>xs=3</Paper>
</Grid>
<Grid item xs={3}>
<Paper className={classes.paper}>xs=3</Paper>
</Grid>
<Grid item xs={8}>
<Paper className={classes.paper}>xs=8</Paper>
</Grid>
<Grid item xs={4}>
<Paper className={classes.paper}>xs=4</Paper>
</Grid>
</Grid>
<Divider className={classes.divider} />
<Typography variant="subtitle1" gutterBottom>
CSS Grid Layout:
</Typography>
<div className={classes.container}>
<div style={{ gridColumnEnd: 'span 3' }}>
<Paper className={classes.paper}>xs=3</Paper>
</div>
<div style={{ gridColumnEnd: 'span 3' }}>
<Paper className={classes.paper}>xs=3</Paper>
</div>
<div style={{ gridColumnEnd: 'span 3' }}>
<Paper className={classes.paper}>xs=3</Paper>
</div>
<div style={{ gridColumnEnd: 'span 3' }}>
<Paper className={classes.paper}>xs=3</Paper>
</div>
<div style={{ gridColumnEnd: 'span 8' }}>
<Paper className={classes.paper}>xs=8</Paper>
</div>
<div style={{ gridColumnEnd: 'span 4' }}>
<Paper className={classes.paper}>xs=4</Paper>
</div>
</div>
</div>
);
}
CSSGrid.propTypes = {
classes: PropTypes.object.isRequired,
};
export default withStyles(styles)(CSSGrid);
|