【发布时间】:2019-04-25 18:43:12
【问题描述】:
也许不是正确的方法,但我想为标题创建一些“全局”样式。像这样的:
const myTheme = createMuiTheme({
headings: {
h1: {
fontSize: 28,
// Obviously this does not work...
[theme.breakpoints.down('sm')]: {
fontSize: 24
},
},
h2: {
fontSize: 24,
}
}
}
然后我可以像这样在我的组件中使用它们:
const styles = (theme) => ({
myElement: {
...theme.headings.h1,
// ... other styles
}
}
这确实有效,但我面临的问题是我希望标题具有响应性并尊重 Material UI 的断点,但我不能在 createMuiTheme 本身中使用它们?有什么方法可以正确地做到这一点,这样我就可以在我的样式中传播,包括响应式样式全部合二为一?
【问题讨论】:
标签: reactjs material-ui