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
|
import React from 'react';
import PropTypes from 'prop-types';
import { withStyles } from '@material-ui/core/styles';
import { Paper, Grid, Avatar, Typography } from '@material-ui/core';
const styles = theme => ({
root: {
overflow: 'hidden',
padding: `0 ${theme.spacing(3)}px`,
},
wrapper: {
maxWidth: 400,
},
paper: {
margin: theme.spacing(1),
padding: theme.spacing(2),
backgroundColor: theme.palette.secondary.light,
},
});
function AutoGridNoWrap(props) {
const { classes } = props;
const message = `Truncation should be conditionally applicable on this long line of text
as this is a much longer line than what the container can support. `;
return (
<div className={classes.root}>
<div className={classes.wrapper}>
<Paper className={classes.paper}>
<Grid container wrap="nowrap">
<Grid item>
<Avatar>W</Avatar>
</Grid>
<Grid item xs zeroMinWidth>
<Typography noWrap>{message}</Typography>
</Grid>
</Grid>
</Paper>
<Paper className={classes.paper}>
<Grid container wrap="nowrap">
<Grid item>
<Avatar>W</Avatar>
</Grid>
<Grid item xs>
<Typography noWrap>{message}</Typography>
</Grid>
</Grid>
</Paper>
<Paper className={classes.paper}>
<Grid container wrap="nowrap">
<Grid item>
<Avatar>W</Avatar>
</Grid>
<Grid item xs>
<Typography>{message}</Typography>
</Grid>
</Grid>
</Paper>
</div>
</div>
);
}
AutoGridNoWrap.propTypes = {
classes: PropTypes.object.isRequired,
};
export default withStyles(styles)(AutoGridNoWrap);
|