Kru*_*hah 7 migration material-ui
我正在尝试将我的 MUI v4 迁移到 v5
尝试替换所有这些实用程序,例如 withStyles、createStyles 和 makeStyles
我现有的代码如下:
export const DrawerThumbnail = withStyles(() =>
createStyles({
drawerPaper: {
width: '200px',
top: 112,
backgroundColor: Color.White,
border: 'none',
marginTop: '2px',
padding: '0px 5px 0px 5px',
},
})
)(({ classes, ...props }: any) => {
return (
<Drawer
variant="permanent"
classes={{
paper: classes.drawerPaper,
}}
anchor="left"
{...props}
/>
);
});
Run Code Online (Sandbox Code Playgroud)
尝试使用@mui/system 中的样式实用程序新代码看起来像这样,但显然它不起作用,因为我不知道如何使用样式实用程序转换上述内容。
export const DrawerThumbnail2 = styled((props: any) =>
<Drawer
variant="permanent"
anchor="left"
{...props}
/>
)`
width: '200px';
top: 112;
background-color: ${Color.White};
border: 'none';
margin-top: '2px';
padding: 0px 5px 0px 5px;
`;
Run Code Online (Sandbox Code Playgroud)
请帮忙
| 归档时间: |
|
| 查看次数: |
584 次 |
| 最近记录: |