【发布时间】:2019-12-02 00:48:22
【问题描述】:
所以我尝试使用这里给出的材料断点https://material-ui.com/customization/breakpoints/ 以及makeStyles 钩子。尝试制作响应式样式时,我无法使用 props.breakpoints.down('600') 。如何在 makeStyles 钩子中使用断点?
bottom: '64px',
height: '54px',
backgroundImage: 'none',
color: 'red'
}
我试过了,但它不起作用。
export const useStyles = makeStyles({
Container: {
position: 'absolute',
zIndex: '5',
bottom: '0',
paddingTop: ' 1%',
left: ' 0',
zIndex: '10',
width: '100vw',
backgroundImage: 'linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(45, 49, 55, 0.81))',
display: 'block',
// height: "74px"
height: props => props.captionHeight,
[props => props.breakpoints.down('600')]: {
bottom: '64px',
height: '54px',
backgroundImage: 'none',
color: 'red'
}
}});
I expect to be able to have apply the styles when the screenwidth is lesser than 600px using the material-ui breakpoints api.
【问题讨论】:
标签: javascript reactjs material-ui react-hooks