forked from mui/material-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[System] Add flag to switch negative margin approach in Grid (mui#33484)
- Loading branch information
1 parent
b59abb1
commit 9391b8c
Showing
11 changed files
with
268 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import * as React from 'react'; | ||
import Box from '@mui/system/Box'; | ||
import Grid from '@mui/system/Unstable_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={(theme) => ({ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
gap: 3, | ||
'& > div': { | ||
overflow: 'auto hidden', | ||
'&::-webkit-scrollbar': { height: 10, WebkitAppearance: 'none' }, | ||
'&::-webkit-scrollbar-thumb': { | ||
borderRadius: 8, | ||
border: '2px solid', | ||
borderColor: theme.palette.mode === 'dark' ? '' : '#E7EBF0', | ||
backgroundColor: 'rgba(0 0 0 / 0.5)', | ||
}, | ||
}, | ||
})} | ||
> | ||
<Box | ||
sx={{ | ||
width: 200, | ||
}} | ||
> | ||
<Grid container spacing={3}> | ||
<Grid xs={12}> | ||
<Item>Scroll bar appears</Item> | ||
</Grid> | ||
</Grid> | ||
</Box> | ||
<Box sx={{ width: 200, overflow: 'scroll' }}> | ||
<Grid container spacing={3} disableEqualOverflow> | ||
<Grid xs={12}> | ||
<Item>`disableEqualOverflow` prevents scrollbar</Item> | ||
</Grid> | ||
</Grid> | ||
</Box> | ||
</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,54 @@ | ||
import * as React from 'react'; | ||
import Box from '@mui/system/Box'; | ||
import Grid from '@mui/system/Unstable_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={(theme) => ({ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
gap: 3, | ||
'& > div': { | ||
overflow: 'auto hidden', | ||
'&::-webkit-scrollbar': { height: 10, WebkitAppearance: 'none' }, | ||
'&::-webkit-scrollbar-thumb': { | ||
borderRadius: 8, | ||
border: '2px solid', | ||
borderColor: theme.palette.mode === 'dark' ? '' : '#E7EBF0', | ||
backgroundColor: 'rgba(0 0 0 / 0.5)', | ||
}, | ||
}, | ||
})} | ||
> | ||
<Box | ||
sx={{ | ||
width: 200, | ||
}} | ||
> | ||
<Grid container spacing={3}> | ||
<Grid xs={12}> | ||
<Item>Scroll bar appears</Item> | ||
</Grid> | ||
</Grid> | ||
</Box> | ||
<Box sx={{ width: 200, overflow: 'scroll' }}> | ||
<Grid container spacing={3} disableEqualOverflow> | ||
<Grid xs={12}> | ||
<Item>`disableEqualOverflow` prevents scrollbar</Item> | ||
</Grid> | ||
</Grid> | ||
</Box> | ||
</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
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
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
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