Skip to content

Commit e955abc

Browse files
authored
fix: stop uding variants for runtime style updates (#1746)
1 parent 3b46da0 commit e955abc

1 file changed

Lines changed: 17 additions & 27 deletions

File tree

webui/src/pages/admin-dashboard/admin-dashboard.tsx

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -119,24 +119,19 @@ interface AppBarProps extends MuiAppBarProps {
119119

120120
const AppBar = styled(MuiAppBar, {
121121
shouldForwardProp: (prop) => prop !== 'open',
122-
})<AppBarProps>(({ theme }) => ({
122+
})<AppBarProps>(({ theme, open }) => ({
123123
transition: theme.transitions.create(['margin', 'width'], {
124124
easing: theme.transitions.easing.sharp,
125125
duration: theme.transitions.duration.leavingScreen,
126126
}),
127-
variants: [
128-
{
129-
props: ({ open }) => open,
130-
style: {
131-
width: `calc(100% - ${drawerWidth}px)`,
132-
marginLeft: `${drawerWidth}px`,
133-
transition: theme.transitions.create(['margin', 'width'], {
134-
easing: theme.transitions.easing.easeOut,
135-
duration: theme.transitions.duration.enteringScreen,
136-
}),
137-
},
138-
},
139-
],
127+
...(open && {
128+
width: `calc(100% - ${drawerWidth}px)`,
129+
marginLeft: `${drawerWidth}px`,
130+
transition: theme.transitions.create(['margin', 'width'], {
131+
easing: theme.transitions.easing.easeOut,
132+
duration: theme.transitions.duration.enteringScreen,
133+
}),
134+
}),
140135
}));
141136

142137
interface LinkRouterProps extends LinkProps {
@@ -178,26 +173,21 @@ const BreadcrumbsComponent = () => {
178173

179174
const Main = styled('main', { shouldForwardProp: (prop) => prop !== 'open' })<{
180175
open?: boolean;
181-
}>(({ theme }) => ({
176+
}>(({ theme, open }) => ({
182177
flexGrow: 1,
183178
padding: theme.spacing(3),
184179
transition: theme.transitions.create('margin', {
185180
easing: theme.transitions.easing.sharp,
186181
duration: theme.transitions.duration.leavingScreen,
187182
}),
188183
marginLeft: `-${drawerWidth}px`,
189-
variants: [
190-
{
191-
props: ({ open }) => open,
192-
style: {
193-
transition: theme.transitions.create('margin', {
194-
easing: theme.transitions.easing.easeOut,
195-
duration: theme.transitions.duration.enteringScreen,
196-
}),
197-
marginLeft: 0,
198-
},
199-
},
200-
],
184+
...(open && {
185+
transition: theme.transitions.create('margin', {
186+
easing: theme.transitions.easing.easeOut,
187+
duration: theme.transitions.duration.enteringScreen,
188+
}),
189+
marginLeft: 0,
190+
}),
201191
}));
202192

203193
export const AdminDashboard: FunctionComponent<AdminDashboardProps> = props => {

0 commit comments

Comments
 (0)