Skip to content

Commit 4cda143

Browse files
authored
[core] Fix mixins not being assignable as JSS styles (#19491)
1 parent bdebdfd commit 4cda143

File tree

2 files changed

+32
-3
lines changed

2 files changed

+32
-3
lines changed

packages/material-ui/src/styles/createMixins.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { Breakpoints } from './createBreakpoints';
22
import { Spacing } from './createSpacing';
3-
import * as React from 'react';
3+
import { CSSProperties } from './withStyles';
44

55
export interface Mixins {
6-
gutters: (styles?: React.CSSProperties) => React.CSSProperties;
7-
toolbar: React.CSSProperties;
6+
gutters: (styles?: CSSProperties) => CSSProperties;
7+
toolbar: CSSProperties;
88
// ... use interface declaration merging to add custom mixins
99
}
1010

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { createMuiTheme, makeStyles } from '@material-ui/core/styles';
2+
3+
{
4+
const theme = createMuiTheme({
5+
mixins: {
6+
toolbar: {
7+
background: '#fff',
8+
minHeight: 36,
9+
'@media (min-width:0px) and (orientation: landscape)': {
10+
minHeight: 24
11+
},
12+
'@media (min-width:600px)': {
13+
minHeight: 48
14+
}
15+
},
16+
}
17+
});
18+
19+
const useStyles = makeStyles(theme => ({
20+
appBarSpacer: theme.mixins.toolbar,
21+
toolbarIcon: {
22+
display: 'flex',
23+
alignItems: 'center',
24+
justifyContent: 'flex-end',
25+
padding: '0 8px',
26+
...theme.mixins.toolbar,
27+
},
28+
}));
29+
}

0 commit comments

Comments
 (0)