Turn on wifi
diff --git a/docs/src/pages/utils/click-away-listener/ClickAway.js b/docs/src/pages/utils/click-away-listener/ClickAway.js
index 158cd803bbdfff..1eee7ae41df8d6 100644
--- a/docs/src/pages/utils/click-away-listener/ClickAway.js
+++ b/docs/src/pages/utils/click-away-listener/ClickAway.js
@@ -18,11 +18,11 @@ const styles = theme => ({
},
fake: {
backgroundColor: grey[200],
- height: theme.spacing.unit,
- margin: theme.spacing.unit * 2,
+ height: theme.spacing(1),
+ margin: theme.spacing(2),
// Selects every two elements among any group of siblings.
'&:nth-child(2n)': {
- marginRight: theme.spacing.unit * 3,
+ marginRight: theme.spacing(3),
},
},
});
diff --git a/docs/src/pages/utils/modal/SimpleModal.js b/docs/src/pages/utils/modal/SimpleModal.js
index 8e62cb69b0e57c..b3bd9a8728d630 100644
--- a/docs/src/pages/utils/modal/SimpleModal.js
+++ b/docs/src/pages/utils/modal/SimpleModal.js
@@ -23,10 +23,10 @@ function getModalStyle() {
const styles = theme => ({
paper: {
position: 'absolute',
- width: theme.spacing.unit * 50,
+ width: 400,
backgroundColor: theme.palette.background.paper,
boxShadow: theme.shadows[5],
- padding: theme.spacing.unit * 4,
+ padding: theme.spacing(4),
outline: 'none',
},
});
diff --git a/docs/src/pages/utils/no-ssr/SimpleNoSsr.js b/docs/src/pages/utils/no-ssr/SimpleNoSsr.js
index 3fc6a056625d0c..3747b994775d5b 100644
--- a/docs/src/pages/utils/no-ssr/SimpleNoSsr.js
+++ b/docs/src/pages/utils/no-ssr/SimpleNoSsr.js
@@ -7,7 +7,7 @@ import Button from '@material-ui/core/Button';
const styles = theme => ({
button: {
display: 'block',
- margin: theme.spacing.unit * 2,
+ margin: theme.spacing(2),
},
});
diff --git a/docs/src/pages/utils/popover/AnchorPlayground.js b/docs/src/pages/utils/popover/AnchorPlayground.js
index f4733cc5688702..37f5a67273a2c3 100644
--- a/docs/src/pages/utils/popover/AnchorPlayground.js
+++ b/docs/src/pages/utils/popover/AnchorPlayground.js
@@ -18,7 +18,7 @@ import InputLabel from '@material-ui/core/InputLabel';
const styles = theme => ({
buttonWrapper: {
position: 'relative',
- marginBottom: theme.spacing.unit * 4,
+ marginBottom: theme.spacing(4),
},
anchor: {
backgroundColor: green[500],
@@ -35,7 +35,7 @@ const styles = theme => ({
},
checked: {},
typography: {
- margin: theme.spacing.unit * 2,
+ margin: theme.spacing(2),
},
});
@@ -142,7 +142,7 @@ class AnchorPlayground extends React.Component {
return (
-
+
{
@@ -181,7 +181,7 @@ class AnchorPlayground extends React.Component {
>
The content of the Popover.
-
+
anchorReference
diff --git a/docs/src/pages/utils/popover/MouseOverPopover.js b/docs/src/pages/utils/popover/MouseOverPopover.js
index 03fafedecaf808..13e3cc860eb1ba 100644
--- a/docs/src/pages/utils/popover/MouseOverPopover.js
+++ b/docs/src/pages/utils/popover/MouseOverPopover.js
@@ -9,7 +9,7 @@ const styles = theme => ({
pointerEvents: 'none',
},
paper: {
- padding: theme.spacing.unit,
+ padding: theme.spacing(1),
},
});
diff --git a/docs/src/pages/utils/popover/PopoverPopupState.js b/docs/src/pages/utils/popover/PopoverPopupState.js
index c755d25a72eb43..40ce63d8d1dac4 100644
--- a/docs/src/pages/utils/popover/PopoverPopupState.js
+++ b/docs/src/pages/utils/popover/PopoverPopupState.js
@@ -8,7 +8,7 @@ import PopupState, { bindTrigger, bindPopover } from 'material-ui-popup-state/in
const styles = theme => ({
typography: {
- margin: theme.spacing.unit * 2,
+ margin: theme.spacing(2),
},
});
diff --git a/docs/src/pages/utils/popover/RenderPropsPopover.js b/docs/src/pages/utils/popover/RenderPropsPopover.js
index ff8aa84246a6d6..305484cd6446b2 100644
--- a/docs/src/pages/utils/popover/RenderPropsPopover.js
+++ b/docs/src/pages/utils/popover/RenderPropsPopover.js
@@ -11,7 +11,7 @@ const WithState = toRenderProps(withState('anchorEl', 'updateAnchorEl', null));
const styles = theme => ({
typography: {
- margin: theme.spacing.unit * 2,
+ margin: theme.spacing(2),
},
});
diff --git a/docs/src/pages/utils/popover/SimplePopover.js b/docs/src/pages/utils/popover/SimplePopover.js
index 67df3e425fc016..e05089bc6437e7 100644
--- a/docs/src/pages/utils/popover/SimplePopover.js
+++ b/docs/src/pages/utils/popover/SimplePopover.js
@@ -7,7 +7,7 @@ import Popover from '@material-ui/core/Popover';
const styles = theme => ({
typography: {
- margin: theme.spacing.unit * 2,
+ margin: theme.spacing(2),
},
});
diff --git a/docs/src/pages/utils/popper/FakedReferencePopper.js b/docs/src/pages/utils/popper/FakedReferencePopper.js
index 992607178309e4..46f78579d7cf4b 100644
--- a/docs/src/pages/utils/popper/FakedReferencePopper.js
+++ b/docs/src/pages/utils/popper/FakedReferencePopper.js
@@ -8,7 +8,7 @@ import Paper from '@material-ui/core/Paper';
const styles = theme => ({
typography: {
- padding: theme.spacing.unit * 2,
+ padding: theme.spacing(2),
},
});
diff --git a/docs/src/pages/utils/popper/NoTransitionPopper.js b/docs/src/pages/utils/popper/NoTransitionPopper.js
index cffc9d89553988..def43f3a33858d 100644
--- a/docs/src/pages/utils/popper/NoTransitionPopper.js
+++ b/docs/src/pages/utils/popper/NoTransitionPopper.js
@@ -8,7 +8,7 @@ import Paper from '@material-ui/core/Paper';
const styles = theme => ({
typography: {
- padding: theme.spacing.unit * 2,
+ padding: theme.spacing(2),
},
});
diff --git a/docs/src/pages/utils/popper/PopperPopupState.js b/docs/src/pages/utils/popper/PopperPopupState.js
index 43b8a44afdd203..1f4f86aa01d547 100644
--- a/docs/src/pages/utils/popper/PopperPopupState.js
+++ b/docs/src/pages/utils/popper/PopperPopupState.js
@@ -10,7 +10,7 @@ import Paper from '@material-ui/core/Paper';
const styles = theme => ({
typography: {
- padding: theme.spacing.unit * 2,
+ padding: theme.spacing(2),
},
});
diff --git a/docs/src/pages/utils/popper/PositionedPopper.js b/docs/src/pages/utils/popper/PositionedPopper.js
index 4f9a5a92af1098..fb2c5a6bc6b55d 100644
--- a/docs/src/pages/utils/popper/PositionedPopper.js
+++ b/docs/src/pages/utils/popper/PositionedPopper.js
@@ -13,7 +13,7 @@ const styles = theme => ({
width: 500,
},
typography: {
- padding: theme.spacing.unit * 2,
+ padding: theme.spacing(2),
},
});
@@ -63,7 +63,7 @@ class PositionedPopper extends React.Component {
left-end
-
+
right-start
diff --git a/docs/src/pages/utils/popper/RenderPropsPopper.js b/docs/src/pages/utils/popper/RenderPropsPopper.js
index 33ca8ead74ffb3..25c4d48da37706 100644
--- a/docs/src/pages/utils/popper/RenderPropsPopper.js
+++ b/docs/src/pages/utils/popper/RenderPropsPopper.js
@@ -13,7 +13,7 @@ const WithState = toRenderProps(withState('anchorEl', 'updateAnchorEl', null));
const styles = theme => ({
typography: {
- padding: theme.spacing.unit * 2,
+ padding: theme.spacing(2),
},
});
diff --git a/docs/src/pages/utils/popper/ScrollPlayground.js b/docs/src/pages/utils/popper/ScrollPlayground.js
index 0dd969760d3d79..3f805f8d6cebca 100644
--- a/docs/src/pages/utils/popper/ScrollPlayground.js
+++ b/docs/src/pages/utils/popper/ScrollPlayground.js
@@ -23,7 +23,7 @@ const styles = theme => ({
scrollContainer: {
height: 400,
overflow: 'auto',
- marginBottom: theme.spacing.unit * 3,
+ marginBottom: theme.spacing(3),
},
scroll: {
position: 'relative',
@@ -32,7 +32,7 @@ const styles = theme => ({
height: '230%',
},
legend: {
- marginTop: theme.spacing.unit * 2,
+ marginTop: theme.spacing(2),
maxWidth: 300,
},
paper: {
@@ -239,7 +239,7 @@ class AnchorPlayground extends React.Component {
-
+
Appearance
diff --git a/docs/src/pages/utils/popper/SimplePopper.js b/docs/src/pages/utils/popper/SimplePopper.js
index adbe4d421a5a8f..99e0adb0da5670 100644
--- a/docs/src/pages/utils/popper/SimplePopper.js
+++ b/docs/src/pages/utils/popper/SimplePopper.js
@@ -9,7 +9,7 @@ import Paper from '@material-ui/core/Paper';
const styles = theme => ({
typography: {
- padding: theme.spacing.unit * 2,
+ padding: theme.spacing(2),
},
});
diff --git a/docs/src/pages/utils/portal/SimplePortal.js b/docs/src/pages/utils/portal/SimplePortal.js
index 09d08f152864d6..26ddf25d8c9891 100644
--- a/docs/src/pages/utils/portal/SimplePortal.js
+++ b/docs/src/pages/utils/portal/SimplePortal.js
@@ -7,8 +7,8 @@ import { withStyles } from '@material-ui/core/styles';
const styles = theme => ({
alert: {
- padding: theme.spacing.unit,
- margin: `${theme.spacing.unit}px 0`,
+ padding: theme.spacing(1),
+ margin: theme.spacing(1, 0),
border: '1px solid',
borderColor: theme.palette.text.primary,
},
diff --git a/docs/src/pages/utils/transitions/SimpleCollapse.js b/docs/src/pages/utils/transitions/SimpleCollapse.js
index 13460b73e9f769..fcc0bddafc9ad7 100644
--- a/docs/src/pages/utils/transitions/SimpleCollapse.js
+++ b/docs/src/pages/utils/transitions/SimpleCollapse.js
@@ -13,7 +13,7 @@ const styles = theme => ({
display: 'flex',
},
paper: {
- margin: theme.spacing.unit,
+ margin: theme.spacing(1),
},
svg: {
width: 100,
diff --git a/docs/src/pages/utils/transitions/SimpleFade.js b/docs/src/pages/utils/transitions/SimpleFade.js
index e1ca5369e85988..517ec932b36ed2 100644
--- a/docs/src/pages/utils/transitions/SimpleFade.js
+++ b/docs/src/pages/utils/transitions/SimpleFade.js
@@ -13,7 +13,7 @@ const styles = theme => ({
display: 'flex',
},
paper: {
- margin: theme.spacing.unit,
+ margin: theme.spacing(1),
},
svg: {
width: 100,
diff --git a/docs/src/pages/utils/transitions/SimpleGrow.js b/docs/src/pages/utils/transitions/SimpleGrow.js
index b04372ba9fbe61..81da82daad8662 100644
--- a/docs/src/pages/utils/transitions/SimpleGrow.js
+++ b/docs/src/pages/utils/transitions/SimpleGrow.js
@@ -13,7 +13,7 @@ const styles = theme => ({
display: 'flex',
},
paper: {
- margin: theme.spacing.unit,
+ margin: theme.spacing(1),
},
svg: {
width: 100,
diff --git a/docs/src/pages/utils/transitions/SimpleSlide.js b/docs/src/pages/utils/transitions/SimpleSlide.js
index cc6414cdde1ba0..e3a30eef552b4a 100644
--- a/docs/src/pages/utils/transitions/SimpleSlide.js
+++ b/docs/src/pages/utils/transitions/SimpleSlide.js
@@ -10,12 +10,12 @@ const styles = theme => ({
height: 180,
},
wrapper: {
- width: 100 + theme.spacing.unit * 2,
+ width: 100 + theme.spacing(2),
},
paper: {
zIndex: 1,
position: 'relative',
- margin: theme.spacing.unit,
+ margin: theme.spacing(1),
},
svg: {
width: 100,
diff --git a/docs/src/pages/utils/transitions/SimpleZoom.js b/docs/src/pages/utils/transitions/SimpleZoom.js
index f83b20b0cbdf35..16e7abc871facc 100644
--- a/docs/src/pages/utils/transitions/SimpleZoom.js
+++ b/docs/src/pages/utils/transitions/SimpleZoom.js
@@ -13,7 +13,7 @@ const styles = theme => ({
display: 'flex',
},
paper: {
- margin: theme.spacing.unit,
+ margin: theme.spacing(1),
},
svg: {
width: 100,
diff --git a/examples/cdn-next/index.html b/examples/cdn-next/index.html
index bc765acbb4dbb5..7532fa337ff486 100644
--- a/examples/cdn-next/index.html
+++ b/examples/cdn-next/index.html
@@ -51,10 +51,10 @@
const styles = theme => ({
root: {
textAlign: 'center',
- paddingTop: theme.spacing.unit * 20,
+ paddingTop: theme.spacing(20),
},
icon: {
- marginRight: theme.spacing.unit,
+ marginRight: theme.spacing(1),
},
});
diff --git a/examples/create-react-app-with-flow/src/pages/index.js b/examples/create-react-app-with-flow/src/pages/index.js
index 795fc0bc80d867..d47054e2e38004 100644
--- a/examples/create-react-app-with-flow/src/pages/index.js
+++ b/examples/create-react-app-with-flow/src/pages/index.js
@@ -14,7 +14,7 @@ import withRoot from '../withRoot';
const styles = (theme: Object) => ({
root: {
textAlign: 'center',
- paddingTop: theme.spacing.unit * 20,
+ paddingTop: theme.spacing(20),
},
});
diff --git a/examples/create-react-app-with-jss/src/pages/index.js b/examples/create-react-app-with-jss/src/pages/index.js
index dedfb39432f7d8..bbc676fd34c881 100644
--- a/examples/create-react-app-with-jss/src/pages/index.js
+++ b/examples/create-react-app-with-jss/src/pages/index.js
@@ -13,7 +13,7 @@ import withRoot from '../withRoot';
const styles = theme => ({
root: {
textAlign: 'center',
- paddingTop: theme.spacing.unit * 20,
+ paddingTop: theme.spacing(20),
},
});
diff --git a/examples/create-react-app-with-typescript/src/pages/index.tsx b/examples/create-react-app-with-typescript/src/pages/index.tsx
index 147f5324b74a12..647ef77b2455d2 100644
--- a/examples/create-react-app-with-typescript/src/pages/index.tsx
+++ b/examples/create-react-app-with-typescript/src/pages/index.tsx
@@ -15,7 +15,7 @@ const styles = (theme: Theme) =>
createStyles({
root: {
textAlign: 'center',
- paddingTop: theme.spacing.unit * 20,
+ paddingTop: theme.spacing(20),
},
});
diff --git a/examples/create-react-app/src/pages/index.js b/examples/create-react-app/src/pages/index.js
index dedfb39432f7d8..bbc676fd34c881 100644
--- a/examples/create-react-app/src/pages/index.js
+++ b/examples/create-react-app/src/pages/index.js
@@ -13,7 +13,7 @@ import withRoot from '../withRoot';
const styles = theme => ({
root: {
textAlign: 'center',
- paddingTop: theme.spacing.unit * 20,
+ paddingTop: theme.spacing(20),
},
});
diff --git a/examples/gatsby/src/pages/about.js b/examples/gatsby/src/pages/about.js
index 3ba75a867ab63d..0f73d65271ab7d 100644
--- a/examples/gatsby/src/pages/about.js
+++ b/examples/gatsby/src/pages/about.js
@@ -9,7 +9,7 @@ import withRoot from '../withRoot';
const styles = theme => ({
root: {
textAlign: 'center',
- paddingTop: theme.spacing.unit * 20,
+ paddingTop: theme.spacing(20),
},
});
diff --git a/examples/gatsby/src/pages/index.js b/examples/gatsby/src/pages/index.js
index 3ac59a5f63f098..bc160f7b60c764 100644
--- a/examples/gatsby/src/pages/index.js
+++ b/examples/gatsby/src/pages/index.js
@@ -14,7 +14,7 @@ import withRoot from '../withRoot';
const styles = theme => ({
root: {
textAlign: 'center',
- paddingTop: theme.spacing.unit * 20,
+ paddingTop: theme.spacing(20),
},
});
diff --git a/examples/nextjs-hooks-with-typescript/pages/about.tsx b/examples/nextjs-hooks-with-typescript/pages/about.tsx
index 5ce60cb0f57292..d62c8cc287a008 100644
--- a/examples/nextjs-hooks-with-typescript/pages/about.tsx
+++ b/examples/nextjs-hooks-with-typescript/pages/about.tsx
@@ -9,7 +9,7 @@ import Link from 'next/link';
const useStyles = makeStyles(theme => ({
root: {
textAlign: 'center',
- paddingTop: theme.spacing.unit * 20,
+ paddingTop: theme.spacing(20),
},
}));
diff --git a/examples/nextjs-hooks-with-typescript/pages/index.tsx b/examples/nextjs-hooks-with-typescript/pages/index.tsx
index b712cd363545f7..63c36d96fc46a2 100644
--- a/examples/nextjs-hooks-with-typescript/pages/index.tsx
+++ b/examples/nextjs-hooks-with-typescript/pages/index.tsx
@@ -14,7 +14,7 @@ import Link from 'next/link';
const useStyles = makeStyles(theme => ({
root: {
textAlign: 'center',
- paddingTop: theme.spacing.unit * 20,
+ paddingTop: theme.spacing(20),
},
}));
diff --git a/examples/nextjs-hooks/pages/about.js b/examples/nextjs-hooks/pages/about.js
index 08e63061c15b5b..b7494c880d0e16 100644
--- a/examples/nextjs-hooks/pages/about.js
+++ b/examples/nextjs-hooks/pages/about.js
@@ -10,7 +10,7 @@ import Link from 'next/link';
const useStyles = makeStyles(theme => ({
root: {
textAlign: 'center',
- paddingTop: theme.spacing.unit * 20,
+ paddingTop: theme.spacing(20),
},
}));
diff --git a/examples/nextjs-hooks/pages/index.js b/examples/nextjs-hooks/pages/index.js
index 97a310183601eb..386d3d555ceac7 100644
--- a/examples/nextjs-hooks/pages/index.js
+++ b/examples/nextjs-hooks/pages/index.js
@@ -15,7 +15,7 @@ import Link from 'next/link';
const useStyles = makeStyles(theme => ({
root: {
textAlign: 'center',
- paddingTop: theme.spacing.unit * 20,
+ paddingTop: theme.spacing(20),
},
}));
diff --git a/examples/nextjs/pages/about.js b/examples/nextjs/pages/about.js
index fb7ebd2578b888..5c25c375676a55 100644
--- a/examples/nextjs/pages/about.js
+++ b/examples/nextjs/pages/about.js
@@ -10,7 +10,7 @@ import Link from 'next/link';
const styles = theme => ({
root: {
textAlign: 'center',
- paddingTop: theme.spacing.unit * 20,
+ paddingTop: theme.spacing(20),
},
});
diff --git a/examples/nextjs/pages/index.js b/examples/nextjs/pages/index.js
index be9e8d8b0ca671..519fb719d48f4a 100644
--- a/examples/nextjs/pages/index.js
+++ b/examples/nextjs/pages/index.js
@@ -15,7 +15,7 @@ import Link from 'next/link';
const styles = theme => ({
root: {
textAlign: 'center',
- paddingTop: theme.spacing.unit * 20,
+ paddingTop: theme.spacing(20),
},
});
diff --git a/examples/parcel/src/pages/index.js b/examples/parcel/src/pages/index.js
index dedfb39432f7d8..bbc676fd34c881 100644
--- a/examples/parcel/src/pages/index.js
+++ b/examples/parcel/src/pages/index.js
@@ -13,7 +13,7 @@ import withRoot from '../withRoot';
const styles = theme => ({
root: {
textAlign: 'center',
- paddingTop: theme.spacing.unit * 20,
+ paddingTop: theme.spacing(20),
},
});
diff --git a/examples/ssr/App.js b/examples/ssr/App.js
index 60940ce238a6da..94c5bb5501006a 100644
--- a/examples/ssr/App.js
+++ b/examples/ssr/App.js
@@ -12,7 +12,7 @@ import { withStyles } from '@material-ui/core/styles';
const styles = theme => ({
root: {
textAlign: 'center',
- paddingTop: theme.spacing.unit * 20,
+ paddingTop: theme.spacing(20),
},
});
diff --git a/packages/material-ui-lab/src/ToggleButton/ToggleButton.js b/packages/material-ui-lab/src/ToggleButton/ToggleButton.js
index 1058392f263a6c..7efd2a8cf6f684 100644
--- a/packages/material-ui-lab/src/ToggleButton/ToggleButton.js
+++ b/packages/material-ui-lab/src/ToggleButton/ToggleButton.js
@@ -14,7 +14,7 @@ export const styles = theme => ({
height: 32,
minWidth: 48,
margin: 0,
- padding: `${theme.spacing.unit - 4}px ${theme.spacing.unit * 1.5}px`,
+ padding: '4px 12px',
borderRadius: 2,
color: fade(theme.palette.action.active, 0.38),
'&$selected': {
diff --git a/packages/material-ui-styles/test/styles.spec.tsx b/packages/material-ui-styles/test/styles.spec.tsx
index a737b03fdd5b5f..53728d546b9e11 100644
--- a/packages/material-ui-styles/test/styles.spec.tsx
+++ b/packages/material-ui-styles/test/styles.spec.tsx
@@ -13,7 +13,7 @@ import { Theme } from '@material-ui/core/styles';
// Example 1
const styles = ({ palette, spacing }: Theme) => ({
root: {
- padding: spacing.unit,
+ padding: spacing(1),
backgroundColor: palette.background.default,
color: palette.primary.dark,
},
@@ -67,7 +67,7 @@ const AnotherStyledSFC = withStyles({
// withTheme
const ComponentWithTheme = withTheme()(({ theme }: WithTheme) => (
- {theme.spacing.unit}
+ {theme.spacing(1)}
));
;
@@ -107,7 +107,7 @@ declare const themed: boolean;
const Foo = withStyles(themedStyles, { withTheme: true })(
class extends React.Component> {
render() {
- return
;
+ return
;
}
},
);
@@ -115,7 +115,7 @@ declare const themed: boolean;
const Bar = withStyles(themedStyles, { withTheme: true })(
({ theme }: WithStyles) => (
-
+
),
);
;
@@ -195,7 +195,7 @@ withStyles(theme =>
inset: {
'&:first-child': {
- paddingLeft: theme.spacing.unit * 7,
+ paddingLeft: theme.spacing(7),
},
},
row: {
diff --git a/packages/material-ui-system/src/spacing.js b/packages/material-ui-system/src/spacing.js
index f8a7c628760366..92c5518f4c6ba8 100644
--- a/packages/material-ui-system/src/spacing.js
+++ b/packages/material-ui-system/src/spacing.js
@@ -61,36 +61,35 @@ const spacingKeys = [
];
function getTransformer(theme) {
- const themeTransformer =
- theme.spacing && theme.spacing.unit != null ? theme.spacing.unit : theme.spacing || 8;
+ const themeSpacing = theme.spacing || 8;
- if (typeof themeTransformer === 'number') {
- return abs => themeTransformer * abs;
+ if (typeof themeSpacing === 'number') {
+ return abs => themeSpacing * abs;
}
- if (Array.isArray(themeTransformer)) {
+ if (Array.isArray(themeSpacing)) {
return abs => {
warning(
- abs <= themeTransformer.length - 1,
+ abs <= themeSpacing.length - 1,
[
`@material-ui/system: the value provided (${abs}) overflows.`,
- `The supported values are: ${JSON.stringify(themeTransformer)}.`,
- `${abs} > ${themeTransformer.length - 1}, you need to add the missing values.`,
+ `The supported values are: ${JSON.stringify(themeSpacing)}.`,
+ `${abs} > ${themeSpacing.length - 1}, you need to add the missing values.`,
].join('\n'),
);
- return themeTransformer[abs];
+ return themeSpacing[abs];
};
}
- if (typeof themeTransformer === 'function') {
- return themeTransformer;
+ if (typeof themeSpacing === 'function') {
+ return themeSpacing;
}
warning(
false,
[
- `@material-ui/system: the \`theme.spacing\` value (${themeTransformer}) is invalid.`,
+ `@material-ui/system: the \`theme.spacing\` value (${themeSpacing}) is invalid.`,
'It should be a number, an array or a function.',
].join('\n'),
);
diff --git a/packages/material-ui/src/Breadcrumbs/BreadcrumbCollapsed.js b/packages/material-ui/src/Breadcrumbs/BreadcrumbCollapsed.js
index ec25b767b979f0..dfe05f2e10af03 100644
--- a/packages/material-ui/src/Breadcrumbs/BreadcrumbCollapsed.js
+++ b/packages/material-ui/src/Breadcrumbs/BreadcrumbCollapsed.js
@@ -14,8 +14,8 @@ const styles = theme => ({
backgroundColor: theme.palette.grey[100],
color: theme.palette.grey[700],
borderRadius: 2,
- marginLeft: theme.spacing.unit / 2,
- marginRight: theme.spacing.unit / 2,
+ marginLeft: theme.spacing(0.5),
+ marginRight: theme.spacing(0.5),
cursor: 'pointer',
'&:hover, &:focus': {
backgroundColor: theme.palette.grey[200],
diff --git a/packages/material-ui/src/Divider/Divider.js b/packages/material-ui/src/Divider/Divider.js
index 69681c82bd47cc..b65de9757c73e7 100644
--- a/packages/material-ui/src/Divider/Divider.js
+++ b/packages/material-ui/src/Divider/Divider.js
@@ -31,8 +31,8 @@ export const styles = theme => ({
},
/* Styles applied to the root element if `variant="middle"`. */
middle: {
- marginLeft: theme.spacing.unit * 2,
- marginRight: theme.spacing.unit * 2,
+ marginLeft: theme.spacing(2),
+ marginRight: theme.spacing(2),
},
});
diff --git a/packages/material-ui/src/Grid/Grid.d.ts b/packages/material-ui/src/Grid/Grid.d.ts
index d73a84560b2e1b..46ef7393510937 100644
--- a/packages/material-ui/src/Grid/Grid.d.ts
+++ b/packages/material-ui/src/Grid/Grid.d.ts
@@ -14,7 +14,7 @@ export type GridContentAlignment =
export type GridDirection = 'row' | 'row-reverse' | 'column' | 'column-reverse';
-export type GridSpacing = 0 | 8 | 16 | 24 | 32 | 40;
+export type GridSpacing = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
export type GridJustification =
| 'flex-start'
diff --git a/packages/material-ui/src/Grid/Grid.js b/packages/material-ui/src/Grid/Grid.js
index 9fcf1aa6e02433..8eef81a8a34170 100644
--- a/packages/material-ui/src/Grid/Grid.js
+++ b/packages/material-ui/src/Grid/Grid.js
@@ -17,7 +17,7 @@ import withStyles from '../styles/withStyles';
import { keys as breakpointKeys } from '../styles/createBreakpoints';
import requirePropFactory from '../utils/requirePropFactory';
-const GUTTERS = [0, 8, 16, 24, 32, 40];
+const SPACINGS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
const GRID_SIZES = ['auto', true, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
function generateGrid(globalStyles, theme, breakpoint) {
@@ -68,17 +68,18 @@ function generateGrid(globalStyles, theme, breakpoint) {
function generateGutter(theme, breakpoint) {
const styles = {};
- GUTTERS.forEach((spacing, index) => {
- if (index === 0) {
- // Skip the default style.
+ SPACINGS.forEach(spacing => {
+ const themeSpacing = theme.spacing(spacing);
+
+ if (themeSpacing === 0) {
return;
}
styles[`spacing-${breakpoint}-${spacing}`] = {
- margin: -spacing / 2,
- width: `calc(100% + ${spacing}px)`,
+ margin: -themeSpacing / 2,
+ width: `calc(100% + ${themeSpacing}px)`,
'& > $item': {
- padding: spacing / 2,
+ padding: themeSpacing / 2,
},
};
});
@@ -322,7 +323,7 @@ Grid.propTypes = {
* Defines the space between the type `item` component.
* It can only be used on a type `container` component.
*/
- spacing: PropTypes.oneOf(GUTTERS),
+ spacing: PropTypes.oneOf(SPACINGS),
/**
* Defines the `flex-wrap` style property.
* It's applied for all screen sizes.
diff --git a/packages/material-ui/src/Grid/Grid.test.js b/packages/material-ui/src/Grid/Grid.test.js
index a9cc2bb4643daa..36ecb20fb70e4a 100644
--- a/packages/material-ui/src/Grid/Grid.test.js
+++ b/packages/material-ui/src/Grid/Grid.test.js
@@ -58,8 +58,8 @@ describe(' ', () => {
describe('prop: spacing', () => {
it('should have a spacing', () => {
- const wrapper = shallow( );
- assert.strictEqual(wrapper.hasClass(classes['spacing-xs-8']), true);
+ const wrapper = shallow( );
+ assert.strictEqual(wrapper.hasClass(classes['spacing-xs-1']), true);
});
});
diff --git a/packages/material-ui/src/styles/createMixins.d.ts b/packages/material-ui/src/styles/createMixins.d.ts
index 223183f3842180..e0dfd0e17e6272 100644
--- a/packages/material-ui/src/styles/createMixins.d.ts
+++ b/packages/material-ui/src/styles/createMixins.d.ts
@@ -1,7 +1,7 @@
import * as React from 'react';
import { Breakpoints } from './createBreakpoints';
-import { Spacing } from './spacing';
+import { Spacing } from './createSpacing';
import { StyleRules } from '../styles';
import { CSSProperties } from './withStyles';
diff --git a/packages/material-ui/src/styles/createMixins.js b/packages/material-ui/src/styles/createMixins.js
index 9e937f546796cb..8cb0b9e5e3ba7e 100644
--- a/packages/material-ui/src/styles/createMixins.js
+++ b/packages/material-ui/src/styles/createMixins.js
@@ -1,12 +1,12 @@
export default function createMixins(breakpoints, spacing, mixins) {
return {
gutters: (styles = {}) => ({
- paddingLeft: spacing.unit * 2,
- paddingRight: spacing.unit * 2,
+ paddingLeft: spacing(2),
+ paddingRight: spacing(2),
...styles,
[breakpoints.up('sm')]: {
- paddingLeft: spacing.unit * 3,
- paddingRight: spacing.unit * 3,
+ paddingLeft: spacing(3),
+ paddingRight: spacing(3),
...styles[breakpoints.up('sm')],
},
}),
diff --git a/packages/material-ui/src/styles/createMuiTheme.d.ts b/packages/material-ui/src/styles/createMuiTheme.d.ts
index 99aeb4ba24080b..0f0c49d6ffb151 100644
--- a/packages/material-ui/src/styles/createMuiTheme.d.ts
+++ b/packages/material-ui/src/styles/createMuiTheme.d.ts
@@ -4,7 +4,7 @@ import { Palette, PaletteOptions } from './createPalette';
import { Typography, TypographyOptions } from './createTypography';
import { Shadows } from './shadows';
import { Shape, ShapeOptions } from './shape';
-import { Spacing, SpacingOptions } from './spacing';
+import { Spacing, SpacingOptions } from './createSpacing';
import { Transitions, TransitionsOptions } from './transitions';
import { ZIndex, ZIndexOptions } from './zIndex';
import { Overrides } from './overrides';
diff --git a/packages/material-ui/src/styles/createMuiTheme.js b/packages/material-ui/src/styles/createMuiTheme.js
index 236ba43ebea9bc..f0c730ab62cce6 100644
--- a/packages/material-ui/src/styles/createMuiTheme.js
+++ b/packages/material-ui/src/styles/createMuiTheme.js
@@ -7,7 +7,7 @@ import createPalette from './createPalette';
import createTypography from './createTypography';
import shadows from './shadows';
import shape from './shape';
-import defaultSpacing from './spacing';
+import createSpacing from './createSpacing';
import transitions from './transitions';
import zIndex from './zIndex';
@@ -17,14 +17,14 @@ function createMuiTheme(options = {}) {
mixins: mixinsInput = {},
palette: paletteInput = {},
shadows: shadowsInput,
- spacing: spacingInput = {},
+ spacing: spacingInput,
typography: typographyInput = {},
...other
} = options;
const palette = createPalette(paletteInput);
const breakpoints = createBreakpoints(breakpointsInput);
- const spacing = { ...defaultSpacing, ...spacingInput };
+ const spacing = createSpacing(spacingInput);
const muiTheme = {
breakpoints,
@@ -35,10 +35,10 @@ function createMuiTheme(options = {}) {
props: {}, // Inject custom properties
shadows: shadowsInput || shadows,
typography: createTypography(palette, typographyInput),
+ spacing,
...deepmerge(
{
shape,
- spacing,
transitions,
zIndex,
},
diff --git a/packages/material-ui/src/styles/createMuiTheme.test.js b/packages/material-ui/src/styles/createMuiTheme.test.js
index df758ca208ff14..ec47e267dcfa70 100644
--- a/packages/material-ui/src/styles/createMuiTheme.test.js
+++ b/packages/material-ui/src/styles/createMuiTheme.test.js
@@ -23,10 +23,10 @@ describe('createMuiTheme', () => {
assert.notStrictEqual(muiTheme.transitions.duration.shorter, undefined);
});
- it('should use the defined spacing unit for the gutters mixin', () => {
- const unit = 100;
- const muiTheme = createMuiTheme({ spacing: { unit } });
- assert.strictEqual(muiTheme.mixins.gutters().paddingLeft, unit * 2);
+ it('should use the defined spacing for the gutters mixin', () => {
+ const spacing = 100;
+ const muiTheme = createMuiTheme({ spacing });
+ assert.strictEqual(muiTheme.mixins.gutters().paddingLeft, spacing * 2);
});
describe('shadows', () => {
diff --git a/packages/material-ui/src/styles/createSpacing.d.ts b/packages/material-ui/src/styles/createSpacing.d.ts
new file mode 100644
index 00000000000000..6ed4c1b253f9f3
--- /dev/null
+++ b/packages/material-ui/src/styles/createSpacing.d.ts
@@ -0,0 +1,5 @@
+export type Spacing = (value: number | string) => number | string;
+
+export type SpacingOptions = number | Spacing;
+
+export default function createSpacing(spacing: SpacingOptions): Spacing;
diff --git a/packages/material-ui/src/styles/createSpacing.js b/packages/material-ui/src/styles/createSpacing.js
new file mode 100644
index 00000000000000..41c706da10153a
--- /dev/null
+++ b/packages/material-ui/src/styles/createSpacing.js
@@ -0,0 +1,69 @@
+import warning from 'warning';
+
+let warnOnce;
+
+export default function createSpacing(spacingInput = 8) {
+ // Already transformed.
+ if (spacingInput.mui) {
+ return spacingInput;
+ }
+
+ // All components align to an 8dp square baseline grid for mobile, tablet, and desktop.
+ // https://material.io/design/layout/understanding-layout.html#pixel-density
+ let transform;
+
+ if (typeof spacingInput === 'function') {
+ transform = spacingInput;
+ } else {
+ warning(
+ typeof spacingInput === 'number',
+ [
+ `Material-UI: the \`theme.spacing\` value (${spacingInput}) is invalid.`,
+ 'It should be a number or a function.',
+ ].join('\n'),
+ );
+ transform = factor => {
+ warning(
+ typeof factor === 'number',
+ `Expected spacing argument to be a number, got ${factor}`,
+ );
+ return spacingInput * factor;
+ };
+ }
+
+ const spacing = (...args) => {
+ warning(args.length <= 4, `Too many arguments, expected [1, 4], got ${args.length}`);
+
+ if (args.length === 1) {
+ return transform(args[0]);
+ }
+
+ return args
+ .map(factor => {
+ const output = transform(factor);
+ return typeof output === 'number' ? `${output}px` : output;
+ })
+ .join(' ');
+ };
+
+ // Backward compatibility, to remove in v5.
+ Object.defineProperty(spacing, 'unit', {
+ get: () => {
+ if (process.env.NODE_ENV !== 'production') {
+ warning(
+ warnOnce && process.env.NODE_ENV !== 'test',
+ [
+ 'Material-UI: theme.spacing.unit usage has been deprecated.',
+ 'It will be removed in v5.',
+ 'You can replace `theme.spacing.unit * 2` with `theme.spacing(2)`.',
+ ].join('\n'),
+ );
+ warnOnce = true;
+ }
+ return spacingInput;
+ },
+ });
+ spacing.mui = true;
+
+ return spacing;
+}
diff --git a/packages/material-ui/src/styles/createSpacing.test.js b/packages/material-ui/src/styles/createSpacing.test.js
new file mode 100644
index 00000000000000..d38205a24c926e
--- /dev/null
+++ b/packages/material-ui/src/styles/createSpacing.test.js
@@ -0,0 +1,60 @@
+import { assert } from 'chai';
+import createSpacing from './createSpacing';
+import consoleErrorMock from 'test/utils/consoleErrorMock';
+
+describe('createSpacing', () => {
+ it('should work as expected', () => {
+ let spacing;
+ spacing = createSpacing();
+ assert.strictEqual(spacing(1), 8);
+ spacing = createSpacing(10);
+ assert.strictEqual(spacing(1), 10);
+ spacing = createSpacing(factor => [0, 8, 16][factor]);
+ assert.strictEqual(spacing(2), 16);
+ spacing = createSpacing(factor => factor ** 2);
+ assert.strictEqual(spacing(2), 4);
+ spacing = createSpacing(factor => `${0.25 * factor}rem`);
+ assert.strictEqual(spacing(2), '0.5rem');
+ });
+
+ it('should support recursion', () => {
+ const spacing = createSpacing();
+ createSpacing(spacing);
+ });
+
+ it('should support multiple arguments', () => {
+ let spacing;
+ spacing = createSpacing();
+ assert.strictEqual(spacing(1, 2), '8px 16px');
+ spacing = createSpacing(factor => `${0.25 * factor}rem`);
+ assert.strictEqual(spacing(1, 2), '0.25rem 0.5rem');
+ });
+
+ describe('warning', () => {
+ beforeEach(() => {
+ consoleErrorMock.spy();
+ });
+
+ afterEach(() => {
+ consoleErrorMock.reset();
+ });
+
+ it('should warn for the deprecated API', () => {
+ const spacing = createSpacing(11);
+ assert.strictEqual(spacing.unit, 11);
+ assert.strictEqual(consoleErrorMock.callCount(), 1);
+ assert.include(consoleErrorMock.args()[0][0], 'theme.spacing.unit usage has been deprecated');
+ });
+
+ it('should warn for wrong input', () => {
+ createSpacing({
+ unit: 4,
+ });
+ assert.strictEqual(consoleErrorMock.callCount(), 1);
+ assert.include(
+ consoleErrorMock.args()[0][0],
+ 'the `theme.spacing` value ([object Object]) is invalid',
+ );
+ });
+ });
+});
diff --git a/packages/material-ui/src/styles/createStyles.test.js b/packages/material-ui/src/styles/createStyles.test.js
index d91cd017e1888c..80dda68d07bdde 100644
--- a/packages/material-ui/src/styles/createStyles.test.js
+++ b/packages/material-ui/src/styles/createStyles.test.js
@@ -1,5 +1,5 @@
import { assert } from 'chai';
-import { createStyles } from '.';
+import createStyles from './createStyles';
describe('createStyles', () => {
it('is the identity function', () => {
diff --git a/packages/material-ui/src/styles/spacing.d.ts b/packages/material-ui/src/styles/spacing.d.ts
deleted file mode 100644
index 515159d5f671a4..00000000000000
--- a/packages/material-ui/src/styles/spacing.d.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-export interface Spacing {
- unit: number;
-}
-
-export type SpacingOptions = Partial;
-
-declare const spacing: Spacing;
-
-export default spacing;
diff --git a/packages/material-ui/src/styles/spacing.js b/packages/material-ui/src/styles/spacing.js
deleted file mode 100644
index c1bcffbb7cd85c..00000000000000
--- a/packages/material-ui/src/styles/spacing.js
+++ /dev/null
@@ -1,7 +0,0 @@
-const spacing = {
- // All components align to an 8dp square baseline grid for mobile, tablet, and desktop.
- // https://material.io/design/layout/understanding-layout.html#pixel-density
- unit: 8,
-};
-
-export default spacing;
diff --git a/packages/material-ui/src/styles/withStyles.test.js b/packages/material-ui/src/styles/withStyles.test.js
index a4fca358b9d3e7..2d4b012f1ea71c 100644
--- a/packages/material-ui/src/styles/withStyles.test.js
+++ b/packages/material-ui/src/styles/withStyles.test.js
@@ -205,7 +205,7 @@ describe('withStyles', () => {
});
it('should work when depending on a theme', () => {
- const styles = theme => ({ root: { padding: theme.spacing.unit } });
+ const styles = theme => ({ root: { padding: theme.spacing(1) } });
const StyledComponent = withStyles(styles, { name: 'MuiTextField' })(Empty);
const wrapper = mount(
diff --git a/packages/material-ui/test/typescript/components.spec.tsx b/packages/material-ui/test/typescript/components.spec.tsx
index cfc805a1047c8f..c627936a859a34 100644
--- a/packages/material-ui/test/typescript/components.spec.tsx
+++ b/packages/material-ui/test/typescript/components.spec.tsx
@@ -661,7 +661,7 @@ const TableTest = () => {
return createStyles({
paper: {
width: '100%',
- marginTop: theme.spacing.unit * 3,
+ marginTop: theme.spacing(3),
backgroundColor,
overflowX: 'auto',
},
@@ -737,7 +737,7 @@ const TabsTest = () => {
const styles: StyleRulesCallback = theme => ({
root: {
flexGrow: 1,
- marginTop: theme.spacing.unit * 3,
+ marginTop: theme.spacing(3),
backgroundColor: theme.palette.background.paper,
},
button: {
diff --git a/packages/material-ui/test/typescript/styles.spec.tsx b/packages/material-ui/test/typescript/styles.spec.tsx
index 2cca6c666cd68e..9ef84d620b8d7e 100644
--- a/packages/material-ui/test/typescript/styles.spec.tsx
+++ b/packages/material-ui/test/typescript/styles.spec.tsx
@@ -25,7 +25,7 @@ interface ComponentProps extends WithStyles {
// Example 1
const styles = ({ palette, spacing }: Theme) => ({
root: {
- padding: spacing.unit,
+ padding: spacing(1),
backgroundColor: palette.background.default,
color: palette.primary.dark,
},
@@ -102,7 +102,7 @@ const theme = createMuiTheme({
short: 50,
},
},
- spacing: {},
+ spacing: 5,
zIndex: {
appBar: 42,
},
@@ -162,7 +162,7 @@ function OverridesTheme() {
}
// withTheme
-const ComponentWithTheme = withTheme()(({ theme }: WithTheme) => {theme.spacing.unit}
);
+const ComponentWithTheme = withTheme()(({ theme }: WithTheme) => {theme.spacing(1)}
);
;
@@ -203,14 +203,14 @@ declare const themed: boolean;
}
render() {
- return
;
+ return
;
}
},
);
;
const Bar = withStyles({}, { withTheme: true })(({ theme }: WithStyles) => (
-
+
));
;
}
@@ -288,7 +288,7 @@ withStyles(theme =>
},
inset: {
'&:first-child': {
- paddingLeft: theme.spacing.unit * 7,
+ paddingLeft: theme.spacing(7),
},
},
row: {
diff --git a/packages/material-ui/test/typescript/stylingComparison.spec.tsx b/packages/material-ui/test/typescript/stylingComparison.spec.tsx
index 50ad2fc07555dc..220319e66f3ac4 100644
--- a/packages/material-ui/test/typescript/stylingComparison.spec.tsx
+++ b/packages/material-ui/test/typescript/stylingComparison.spec.tsx
@@ -5,7 +5,7 @@ import Typography, { TypographyProps } from '@material-ui/core/Typography';
const styles = ({ palette, spacing }: Theme) =>
createStyles({
root: {
- padding: spacing.unit,
+ padding: spacing(1),
backgroundColor: palette.background.default,
color: palette.primary.dark,
},
diff --git a/pages/api/grid.md b/pages/api/grid.md
index 52751db0d7fe28..cb5e5a71317d7f 100644
--- a/pages/api/grid.md
+++ b/pages/api/grid.md
@@ -30,7 +30,7 @@ import Grid from '@material-ui/core/Grid';
| lg | enum: false, 'auto', true, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 | false | Defines the number of grids the component is going to use. It's applied for the `lg` breakpoint and wider screens if not overridden. |
| md | enum: false, 'auto', true, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 | false | Defines the number of grids the component is going to use. It's applied for the `md` breakpoint and wider screens if not overridden. |
| sm | enum: false, 'auto', true, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 | false | Defines the number of grids the component is going to use. It's applied for the `sm` breakpoint and wider screens if not overridden. |
-| spacing | enum: 0, 8, 16, 24, 32, 40 | 0 | Defines the space between the type `item` component. It can only be used on a type `container` component. |
+| spacing | enum: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 | 0 | Defines the space between the type `item` component. It can only be used on a type `container` component. |
| wrap | enum: 'nowrap' | 'wrap' | 'wrap-reverse' | 'wrap' | Defines the `flex-wrap` style property. It's applied for all screen sizes. |
| xl | enum: false, 'auto', true, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 | false | Defines the number of grids the component is going to use. It's applied for the `xl` breakpoint and wider screens. |
| xs | enum: false, 'auto', true, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 | false | Defines the number of grids the component is going to use. It's applied for all the screen sizes with the lowest priority. |
@@ -68,11 +68,16 @@ This property accepts the following keys:
| justify-xs-space-between |
| justify-xs-space-around |
| justify-xs-space-evenly |
+| spacing-xs-1 |
+| spacing-xs-2 |
+| spacing-xs-3 |
+| spacing-xs-4 |
+| spacing-xs-5 |
+| spacing-xs-6 |
+| spacing-xs-7 |
| spacing-xs-8 |
-| spacing-xs-16 |
-| spacing-xs-24 |
-| spacing-xs-32 |
-| spacing-xs-40 |
+| spacing-xs-9 |
+| spacing-xs-10 |
| grid-xs-auto |
| grid-xs-true |
| grid-xs-1 |
diff --git a/pages/index.js b/pages/index.js
index e260ef4f652da3..2c0d9e72d807f9 100644
--- a/pages/index.js
+++ b/pages/index.js
@@ -57,31 +57,31 @@ const styles = theme => ({
whiteSpace: 'nowrap',
},
headline: {
- paddingLeft: theme.spacing.unit * 4,
- paddingRight: theme.spacing.unit * 4,
- marginTop: theme.spacing.unit,
+ paddingLeft: theme.spacing(4),
+ paddingRight: theme.spacing(4),
+ marginTop: theme.spacing(1),
maxWidth: 500,
textAlign: 'center',
},
content: {
- paddingBottom: theme.spacing.unit * 8,
- paddingTop: theme.spacing.unit * 8,
+ paddingBottom: theme.spacing(8),
+ paddingTop: theme.spacing(8),
[theme.breakpoints.up('sm')]: {
- paddingTop: theme.spacing.unit * 12,
+ paddingTop: theme.spacing(12),
},
},
button: {
- marginTop: theme.spacing.unit * 3,
+ marginTop: theme.spacing(3),
},
logo: {
- margin: `${theme.spacing.unit * 3}px 0 ${theme.spacing.unit * 4}px`,
+ margin: theme.spacing(3, 0, 4),
width: '100%',
height: '35vw',
maxHeight: 200,
},
social: {
backgroundColor: theme.palette.background.paper,
- padding: `${theme.spacing.unit * 2}px 0`,
+ padding: theme.spacing(2, 0),
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
@@ -89,7 +89,7 @@ const styles = theme => ({
boxSizing: 'content-box',
'& span': {
display: 'flex',
- marginRight: theme.spacing.unit,
+ marginRight: theme.spacing(1),
},
'& a': {
color: theme.palette.background.paper,
diff --git a/test/regressions/TestViewer.js b/test/regressions/TestViewer.js
index 652752dfb7d1e1..752a34385410ee 100644
--- a/test/regressions/TestViewer.js
+++ b/test/regressions/TestViewer.js
@@ -23,7 +23,7 @@ const styles = theme => ({
},
root: {
backgroundColor: theme.palette.background.default,
- padding: theme.spacing.unit,
+ padding: theme.spacing(1),
},
});
diff --git a/test/regressions/tests/Grid/AutoGrid.js b/test/regressions/tests/Grid/AutoGrid.js
index 72a975a49620d8..78569917cb2a07 100644
--- a/test/regressions/tests/Grid/AutoGrid.js
+++ b/test/regressions/tests/Grid/AutoGrid.js
@@ -19,7 +19,7 @@ function AutoGrid(props) {
return (
-
+
xs
@@ -30,7 +30,7 @@ function AutoGrid(props) {
xs
-
+
xs
diff --git a/test/regressions/tests/Grid/SimpleGrid.js b/test/regressions/tests/Grid/SimpleGrid.js
index b5e6de27c8685d..ad7a20e97cd27d 100644
--- a/test/regressions/tests/Grid/SimpleGrid.js
+++ b/test/regressions/tests/Grid/SimpleGrid.js
@@ -19,7 +19,7 @@ function SimpleGrid(props) {
return (
-
+
xs=12
diff --git a/test/regressions/tests/Grid/StressGrid.js b/test/regressions/tests/Grid/StressGrid.js
index b9b72a24ebe9b7..07eacce3a5b105 100644
--- a/test/regressions/tests/Grid/StressGrid.js
+++ b/test/regressions/tests/Grid/StressGrid.js
@@ -20,8 +20,8 @@ function StressGrid(props) {
return (
-
-
+
+
xs=3
@@ -29,7 +29,7 @@ function StressGrid(props) {
xs=9
-
+
first
@@ -37,7 +37,7 @@ function StressGrid(props) {
last
-
+
space
@@ -45,7 +45,7 @@ function StressGrid(props) {
between
-
+
reverse
diff --git a/test/regressions/tests/Table/PaddingTable.js b/test/regressions/tests/Table/PaddingTable.js
index 374f6a69a8e7a5..1493b0561fc3a3 100644
--- a/test/regressions/tests/Table/PaddingTable.js
+++ b/test/regressions/tests/Table/PaddingTable.js
@@ -41,7 +41,7 @@ MyTable.propTypes = {
function PaddingTable() {
return (
-
+
diff --git a/test/regressions/tests/Tooltip/PositionedTooltips.js b/test/regressions/tests/Tooltip/PositionedTooltips.js
index ed6b15d299c2ce..f8f7790a781968 100644
--- a/test/regressions/tests/Tooltip/PositionedTooltips.js
+++ b/test/regressions/tests/Tooltip/PositionedTooltips.js
@@ -45,7 +45,7 @@ function PositionedTooltips(props) {
left-end
-
+
right-start