1
1
import * as React from 'react' ;
2
- import { styled } from '@mui/material/styles' ;
3
2
import Box from '@mui/material/Box' ;
4
3
import Paper from '@mui/material/Paper' ;
5
4
import Grid from '@mui/material/Grid' ;
6
5
import Avatar from '@mui/material/Avatar' ;
7
6
import Typography from '@mui/material/Typography' ;
8
7
9
- const StyledPaper = styled ( Paper ) ( ( { theme } ) => ( {
10
- backgroundColor : theme . palette . mode === 'dark' ? '#1A2027' : '#fff' ,
11
- ...theme . typography . body2 ,
12
- padding : theme . spacing ( 2 ) ,
13
- maxWidth : 400 ,
14
- color : theme . palette . text . primary ,
15
- } ) ) ;
16
-
17
8
const message = `Truncation should be conditionally applicable on this long line of text
18
9
as this is a much longer line than what the container can support. ` ;
19
10
20
11
export default function AutoGridNoWrap ( ) {
21
12
return (
22
13
< Box sx = { { flexGrow : 1 , overflow : 'hidden' , px : 3 } } >
23
- < StyledPaper
24
- sx = { {
25
- my : 1 ,
26
- mx : 'auto' ,
27
- p : 2 ,
28
- } }
29
- >
14
+ < Paper sx = { { maxWidth : 400 , my : 1 , mx : 'auto' , p : 2 } } >
30
15
< Grid container wrap = "nowrap" spacing = { 2 } >
31
16
< Grid item >
32
17
< Avatar > W</ Avatar >
@@ -35,14 +20,8 @@ export default function AutoGridNoWrap() {
35
20
< Typography noWrap > { message } </ Typography >
36
21
</ Grid >
37
22
</ Grid >
38
- </ StyledPaper >
39
- < StyledPaper
40
- sx = { {
41
- my : 1 ,
42
- mx : 'auto' ,
43
- p : 2 ,
44
- } }
45
- >
23
+ </ Paper >
24
+ < Paper sx = { { maxWidth : 400 , my : 1 , mx : 'auto' , p : 2 } } >
46
25
< Grid container wrap = "nowrap" spacing = { 2 } >
47
26
< Grid item >
48
27
< Avatar > W</ Avatar >
@@ -51,14 +30,8 @@ export default function AutoGridNoWrap() {
51
30
< Typography noWrap > { message } </ Typography >
52
31
</ Grid >
53
32
</ Grid >
54
- </ StyledPaper >
55
- < StyledPaper
56
- sx = { {
57
- my : 1 ,
58
- mx : 'auto' ,
59
- p : 2 ,
60
- } }
61
- >
33
+ </ Paper >
34
+ < Paper sx = { { maxWidth : 400 , my : 1 , mx : 'auto' , p : 2 } } >
62
35
< Grid container wrap = "nowrap" spacing = { 2 } >
63
36
< Grid item >
64
37
< Avatar > W</ Avatar >
@@ -67,7 +40,7 @@ export default function AutoGridNoWrap() {
67
40
< Typography > { message } </ Typography >
68
41
</ Grid >
69
42
</ Grid >
70
- </ StyledPaper >
43
+ </ Paper >
71
44
</ Box >
72
45
) ;
73
46
}
0 commit comments