-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[system] Add new
Grid
implementation (#32746)
- Loading branch information
1 parent
55331cf
commit dcb9db3
Showing
72 changed files
with
3,262 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import * as React from 'react'; | ||
import Grid from '@mui/material/Grid'; | ||
|
||
export default function GridMaterialUI() { | ||
return ( | ||
<Grid container spacing={2}> | ||
{new Array(1000).fill().map(() => ( | ||
<Grid item xs={12} sm={6} md={4}> | ||
test case | ||
</Grid> | ||
))} | ||
</Grid> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import * as React from 'react'; | ||
import { styled } from '@mui/material/styles'; | ||
|
||
const Container = styled('div')({ display: 'flex', flexWrap: 'wrap', gap: 2 }); | ||
|
||
const Item = styled('div')(({ theme }) => ({ | ||
width: '100%', | ||
[theme.breakpoints.up('sm')]: { | ||
width: '50%', | ||
}, | ||
[theme.breakpoints.up('md')]: { | ||
width: 'calc(100% / 4)', | ||
}, | ||
})); | ||
|
||
export default function GridSimple() { | ||
return ( | ||
<Container> | ||
{new Array(1000).fill().map(() => ( | ||
<Item>test case</Item> | ||
))} | ||
</Container> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import * as React from 'react'; | ||
import Grid from '@mui/system/Grid'; | ||
|
||
export default function GridSystem() { | ||
return ( | ||
<Grid container spacing={2}> | ||
{new Array(1000).fill().map(() => ( | ||
<Grid xs={12} sm={6} md={4}> | ||
test case | ||
</Grid> | ||
))} | ||
</Grid> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import * as React from 'react'; | ||
import Box from '@mui/system/Box'; | ||
import Grid from '@mui/system/Grid'; | ||
import styled from '@mui/system/styled'; | ||
|
||
const Item = styled('div')(({ theme }) => ({ | ||
backgroundColor: theme.palette.mode === 'dark' ? '#1A2027' : '#fff', | ||
border: '1px solid', | ||
borderColor: theme.palette.mode === 'dark' ? '#444d58' : '#ced7e0', | ||
padding: theme.spacing(1), | ||
borderRadius: '4px', | ||
textAlign: 'center', | ||
})); | ||
|
||
export default function AutoGrid() { | ||
return ( | ||
<Box sx={{ flexGrow: 1 }}> | ||
<Grid container spacing={3}> | ||
<Grid xs> | ||
<Item>xs</Item> | ||
</Grid> | ||
<Grid xs={6}> | ||
<Item>xs=6</Item> | ||
</Grid> | ||
<Grid xs> | ||
<Item>xs</Item> | ||
</Grid> | ||
</Grid> | ||
</Box> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import * as React from 'react'; | ||
import Box from '@mui/system/Box'; | ||
import Grid from '@mui/system/Grid'; | ||
import styled from '@mui/system/styled'; | ||
|
||
const Item = styled('div')(({ theme }) => ({ | ||
backgroundColor: theme.palette.mode === 'dark' ? '#1A2027' : '#fff', | ||
border: '1px solid', | ||
borderColor: theme.palette.mode === 'dark' ? '#444d58' : '#ced7e0', | ||
padding: theme.spacing(1), | ||
borderRadius: '4px', | ||
textAlign: 'center', | ||
})); | ||
|
||
export default function AutoGrid() { | ||
return ( | ||
<Box sx={{ flexGrow: 1 }}> | ||
<Grid container spacing={3}> | ||
<Grid xs> | ||
<Item>xs</Item> | ||
</Grid> | ||
<Grid xs={6}> | ||
<Item>xs=6</Item> | ||
</Grid> | ||
<Grid xs> | ||
<Item>xs</Item> | ||
</Grid> | ||
</Grid> | ||
</Box> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<Grid container spacing={3}> | ||
<Grid xs> | ||
<Item>xs</Item> | ||
</Grid> | ||
<Grid xs={6}> | ||
<Item>xs=6</Item> | ||
</Grid> | ||
<Grid xs> | ||
<Item>xs</Item> | ||
</Grid> | ||
</Grid> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import * as React from 'react'; | ||
import Box from '@mui/system/Box'; | ||
import Grid from '@mui/system/Grid'; | ||
import styled from '@mui/system/styled'; | ||
import Avatar from '@mui/material/Avatar'; | ||
import Typography from '@mui/material/Typography'; | ||
|
||
const Item = styled('div')(({ theme }) => ({ | ||
border: '1px solid', | ||
borderColor: theme.palette.mode === 'dark' ? '#444d58' : '#ced7e0', | ||
borderRadius: '4px', | ||
})); | ||
|
||
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. `; | ||
|
||
export default function AutoGridNoWrap() { | ||
return ( | ||
<Box sx={{ flexGrow: 1, overflow: 'hidden', px: 3, maxWidth: 400 }}> | ||
<Item | ||
sx={{ | ||
my: 1, | ||
mx: 'auto', | ||
p: 2, | ||
}} | ||
> | ||
<Grid container wrap="nowrap" spacing={2}> | ||
<Grid> | ||
<Avatar>W</Avatar> | ||
</Grid> | ||
<Grid xs> | ||
<Typography noWrap>{message}</Typography> | ||
</Grid> | ||
</Grid> | ||
</Item> | ||
<Item | ||
sx={{ | ||
my: 1, | ||
mx: 'auto', | ||
p: 2, | ||
}} | ||
> | ||
<Grid container wrap="nowrap" spacing={2}> | ||
<Grid> | ||
<Avatar>W</Avatar> | ||
</Grid> | ||
<Grid xs> | ||
<Typography | ||
sx={{ | ||
display: '-webkit-box', | ||
WebkitLineClamp: '3', | ||
WebkitBoxOrient: 'vertical', | ||
overflow: 'hidden', | ||
}} | ||
> | ||
{message} | ||
</Typography> | ||
</Grid> | ||
</Grid> | ||
</Item> | ||
</Box> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import * as React from 'react'; | ||
import Box from '@mui/system/Box'; | ||
import Grid from '@mui/system/Grid'; | ||
import styled from '@mui/system/styled'; | ||
import Avatar from '@mui/material/Avatar'; | ||
import Typography from '@mui/material/Typography'; | ||
|
||
const Item = styled('div')(({ theme }) => ({ | ||
border: '1px solid', | ||
borderColor: theme.palette.mode === 'dark' ? '#444d58' : '#ced7e0', | ||
borderRadius: '4px', | ||
})); | ||
|
||
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. `; | ||
|
||
export default function AutoGridNoWrap() { | ||
return ( | ||
<Box sx={{ flexGrow: 1, overflow: 'hidden', px: 3, maxWidth: 400 }}> | ||
<Item | ||
sx={{ | ||
my: 1, | ||
mx: 'auto', | ||
p: 2, | ||
}} | ||
> | ||
<Grid container wrap="nowrap" spacing={2}> | ||
<Grid> | ||
<Avatar>W</Avatar> | ||
</Grid> | ||
<Grid xs> | ||
<Typography noWrap>{message}</Typography> | ||
</Grid> | ||
</Grid> | ||
</Item> | ||
<Item | ||
sx={{ | ||
my: 1, | ||
mx: 'auto', | ||
p: 2, | ||
}} | ||
> | ||
<Grid container wrap="nowrap" spacing={2}> | ||
<Grid> | ||
<Avatar>W</Avatar> | ||
</Grid> | ||
<Grid xs> | ||
<Typography | ||
sx={{ | ||
display: '-webkit-box', | ||
WebkitLineClamp: '3', | ||
WebkitBoxOrient: 'vertical', | ||
overflow: 'hidden', | ||
}} | ||
> | ||
{message} | ||
</Typography> | ||
</Grid> | ||
</Grid> | ||
</Item> | ||
</Box> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import * as React from 'react'; | ||
import Box from '@mui/system/Box'; | ||
import Grid from '@mui/system/Grid'; | ||
import styled from '@mui/system/styled'; | ||
|
||
const Item = styled('div')(({ theme }) => ({ | ||
backgroundColor: theme.palette.mode === 'dark' ? '#1A2027' : '#fff', | ||
border: '1px solid', | ||
borderColor: theme.palette.mode === 'dark' ? '#444d58' : '#ced7e0', | ||
padding: theme.spacing(1), | ||
borderRadius: '4px', | ||
textAlign: 'center', | ||
})); | ||
|
||
export default function BasicGrid() { | ||
return ( | ||
<Box sx={{ flexGrow: 1 }}> | ||
<Grid container spacing={2}> | ||
<Grid xs={8}> | ||
<Item>xs=8</Item> | ||
</Grid> | ||
<Grid xs={4}> | ||
<Item>xs=4</Item> | ||
</Grid> | ||
<Grid xs={4}> | ||
<Item>xs=4</Item> | ||
</Grid> | ||
<Grid xs={8}> | ||
<Item>xs=8</Item> | ||
</Grid> | ||
</Grid> | ||
</Box> | ||
); | ||
} |
Oops, something went wrong.