One of the challenges I am facing in my application is to dynamically change the paddingLeft of the container based on whether the side nav menu is selected open or closed.
I have a variable called open
that indicates the current state of the side nav.
Approach I attempted:
In an attempt to solve this issue, I added a sx
property while rendering the container to adjust the padding accordingly.
<Container maxWidth={false} className={classes.container}
sx = {{paddingLeft: open ? "theme.spacing(34)" : "theme.spacing(200)"}}>
Unfortunately, this approach did not work as expected; the padding is not getting applied.
I wonder if I am misunderstanding how to use the sx property, or if there is another way to achieve this using inline styles?