Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Dialog] Reduce margins #17867

Merged
merged 2 commits into from
Oct 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/pages/api/dialog.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Dialogs are overlaid modal paper based components with a backdrop.
| <span class="prop-name">disableBackdropClick</span> | <span class="prop-type">bool</span> | <span class="prop-default">false</span> | If `true`, clicking the backdrop will not fire the `onClose` callback. |
| <span class="prop-name">disableEscapeKeyDown</span> | <span class="prop-type">bool</span> | <span class="prop-default">false</span> | If `true`, hitting escape will not fire the `onClose` callback. |
| <span class="prop-name">fullScreen</span> | <span class="prop-type">bool</span> | <span class="prop-default">false</span> | If `true`, the dialog will be full-screen |
| <span class="prop-name">fullWidth</span> | <span class="prop-type">bool</span> | <span class="prop-default">false</span> | If `true`, the dialog stretches to `maxWidth`. |
| <span class="prop-name">fullWidth</span> | <span class="prop-type">bool</span> | <span class="prop-default">false</span> | If `true`, the dialog stretches to `maxWidth`.<br>Notice that the dialog width grow is limited by the default margin. |
| <span class="prop-name">maxWidth</span> | <span class="prop-type">'xs'<br>&#124;&nbsp;'sm'<br>&#124;&nbsp;'md'<br>&#124;&nbsp;'lg'<br>&#124;&nbsp;'xl'<br>&#124;&nbsp;false</span> | <span class="prop-default">'sm'</span> | Determine the max-width of the dialog. The dialog width grows with the size of the screen. Set to `false` to disable `maxWidth`. |
| <span class="prop-name">onBackdropClick</span> | <span class="prop-type">func</span> | | Callback fired when the backdrop is clicked. |
| <span class="prop-name">onClose</span> | <span class="prop-type">func</span> | | Callback fired when the component requests to be closed.<br><br>**Signature:**<br>`function(event: object, reason: string) => void`<br>*event:* The event source of the callback.<br>*reason:* Can be:`"escapeKeyDown"`, `"backdropClick"`. |
Expand Down
30 changes: 16 additions & 14 deletions packages/material-ui/src/Dialog/Dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const styles = theme => ({
},
/* Styles applied to the `Paper` component. */
paper: {
margin: 48,
margin: 32,
position: 'relative',
overflowY: 'auto', // Fix IE 11 issue, to remove at some point.
'@media print': {
Expand All @@ -61,7 +61,7 @@ export const styles = theme => ({
paperScrollPaper: {
display: 'flex',
flexDirection: 'column',
maxHeight: 'calc(100% - 96px)',
maxHeight: 'calc(100% - 64px)',
},
/* Styles applied to the `Paper` component if `scroll="body"`. */
paperScrollBody: {
Expand All @@ -71,56 +71,56 @@ export const styles = theme => ({
},
/* Styles applied to the `Paper` component if `maxWidth=false`. */
paperWidthFalse: {
maxWidth: 'calc(100% - 96px)',
maxWidth: 'calc(100% - 64px)',
},
/* Styles applied to the `Paper` component if `maxWidth="xs"`. */
paperWidthXs: {
maxWidth: Math.max(theme.breakpoints.values.xs, 444),
'&$paperScrollBody': {
[theme.breakpoints.down(Math.max(theme.breakpoints.values.xs, 444) + 48 * 2)]: {
maxWidth: 'calc(100% - 96px)',
[theme.breakpoints.down(Math.max(theme.breakpoints.values.xs, 444) + 32 * 2)]: {
maxWidth: 'calc(100% - 64px)',
},
},
},
/* Styles applied to the `Paper` component if `maxWidth="sm"`. */
paperWidthSm: {
maxWidth: theme.breakpoints.values.sm,
'&$paperScrollBody': {
[theme.breakpoints.down(theme.breakpoints.values.sm + 48 * 2)]: {
maxWidth: 'calc(100% - 96px)',
[theme.breakpoints.down(theme.breakpoints.values.sm + 32 * 2)]: {
maxWidth: 'calc(100% - 64px)',
},
},
},
/* Styles applied to the `Paper` component if `maxWidth="md"`. */
paperWidthMd: {
maxWidth: theme.breakpoints.values.md,
'&$paperScrollBody': {
[theme.breakpoints.down(theme.breakpoints.values.md + 48 * 2)]: {
maxWidth: 'calc(100% - 96px)',
[theme.breakpoints.down(theme.breakpoints.values.md + 32 * 2)]: {
maxWidth: 'calc(100% - 64px)',
},
},
},
/* Styles applied to the `Paper` component if `maxWidth="lg"`. */
paperWidthLg: {
maxWidth: theme.breakpoints.values.lg,
'&$paperScrollBody': {
[theme.breakpoints.down(theme.breakpoints.values.lg + 48 * 2)]: {
maxWidth: 'calc(100% - 96px)',
[theme.breakpoints.down(theme.breakpoints.values.lg + 32 * 2)]: {
maxWidth: 'calc(100% - 64px)',
},
},
},
/* Styles applied to the `Paper` component if `maxWidth="xl"`. */
paperWidthXl: {
maxWidth: theme.breakpoints.values.xl,
'&$paperScrollBody': {
[theme.breakpoints.down(theme.breakpoints.values.xl + 48 * 2)]: {
maxWidth: 'calc(100% - 96px)',
[theme.breakpoints.down(theme.breakpoints.values.xl + 32 * 2)]: {
maxWidth: 'calc(100% - 64px)',
},
},
},
/* Styles applied to the `Paper` component if `fullWidth={true}`. */
paperFullWidth: {
width: 'calc(100% - 96px)',
width: 'calc(100% - 64px)',
},
/* Styles applied to the `Paper` component if `fullScreen={true}`. */
paperFullScreen: {
Expand Down Expand Up @@ -292,6 +292,8 @@ Dialog.propTypes = {
fullScreen: PropTypes.bool,
/**
* If `true`, the dialog stretches to `maxWidth`.
*
* Notice that the dialog width grow is limited by the default margin.
*/
fullWidth: PropTypes.bool,
/**
Expand Down