Skip to content

Commit c60fbba

Browse files
authored
[Container] Fix support of custom breakpoint units (#23191)
1 parent 64629bd commit c60fbba

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

packages/material-ui/src/Container/Container.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,39 +30,39 @@ export const styles = (theme) => ({
3030

3131
if (value !== 0) {
3232
acc[theme.breakpoints.up(breakpoint)] = {
33-
maxWidth: value,
33+
maxWidth: `${value}${theme.breakpoints.unit}`,
3434
};
3535
}
3636
return acc;
3737
}, {}),
3838
/* Styles applied to the root element if `maxWidth="xs"`. */
3939
maxWidthXs: {
4040
[theme.breakpoints.up('xs')]: {
41-
maxWidth: Math.max(theme.breakpoints.values.xs, 444),
41+
maxWidth: Math.max(`${theme.breakpoints.values.xs}${theme.breakpoints.unit}`, 444),
4242
},
4343
},
4444
/* Styles applied to the root element if `maxWidth="sm"`. */
4545
maxWidthSm: {
4646
[theme.breakpoints.up('sm')]: {
47-
maxWidth: theme.breakpoints.values.sm,
47+
maxWidth: `${theme.breakpoints.values.sm}${theme.breakpoints.unit}`,
4848
},
4949
},
5050
/* Styles applied to the root element if `maxWidth="md"`. */
5151
maxWidthMd: {
5252
[theme.breakpoints.up('md')]: {
53-
maxWidth: theme.breakpoints.values.md,
53+
maxWidth: `${theme.breakpoints.values.md}${theme.breakpoints.unit}`,
5454
},
5555
},
5656
/* Styles applied to the root element if `maxWidth="lg"`. */
5757
maxWidthLg: {
5858
[theme.breakpoints.up('lg')]: {
59-
maxWidth: theme.breakpoints.values.lg,
59+
maxWidth: `${theme.breakpoints.values.lg}${theme.breakpoints.unit}`,
6060
},
6161
},
6262
/* Styles applied to the root element if `maxWidth="xl"`. */
6363
maxWidthXl: {
6464
[theme.breakpoints.up('xl')]: {
65-
maxWidth: theme.breakpoints.values.xl,
65+
maxWidth: `${theme.breakpoints.values.xl}${theme.breakpoints.unit}`,
6666
},
6767
},
6868
});

packages/material-ui/src/styles/createBreakpoints.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ export default function createBreakpoints(breakpoints) {
6767
between,
6868
only,
6969
width,
70+
unit,
7071
...other,
7172
};
7273
}

0 commit comments

Comments
 (0)