在 makeStyles 主题上设置 with 和 height material-ui

set with and height on makeStyles theme material-ui

const useStyles = makeStyles(
  (theme) => ({
    iconContainer: {
      margin: theme.spacing(0, 4, 0, 0),
      [theme.breakpoints.up('md')]: {
        margin: theme.spacing(-1, 5, 0, -1),
      },
    },

   <Grid item className={classes.iconContainer}>
          {icon}
        </Grid>

管理层:

How to via theme to set with and height of class iconContainer

您只需将 height/width 添加到 useStyles 对象即可。

iconContainer: {
   width: 100, // px, you can use other units as well '40em', '40rem', '40%', etc... 
   height: 50, 
}