Commit bacc2031 authored by ddcat1115's avatar ddcat1115

fix title can't be hidden in <img /> type icon when menu collapsed

parent bf833b03
...@@ -14,7 +14,7 @@ const { SubMenu } = Menu; ...@@ -14,7 +14,7 @@ const { SubMenu } = Menu;
// icon: <Icon type="setting" />, // icon: <Icon type="setting" />,
const getIcon = (icon) => { const getIcon = (icon) => {
if (typeof icon === 'string' && icon.indexOf('http') === 0) { if (typeof icon === 'string' && icon.indexOf('http') === 0) {
return <img src={icon} alt="icon" className={styles.icon} />; return <img src={icon} alt="icon" className={`${styles.icon} sider-menu-item-img`} />;
} }
if (typeof icon === 'string') { if (typeof icon === 'string') {
return <Icon type={icon} />; return <Icon type={icon} />;
......
...@@ -49,4 +49,18 @@ ...@@ -49,4 +49,18 @@
.drawer .drawer-content { .drawer .drawer-content {
background: #001529; background: #001529;
} }
.ant-menu-inline-collapsed {
& > .ant-menu-item .sider-menu-item-img + span,
& > .ant-menu-item-group > .ant-menu-item-group-list > .ant-menu-item .sider-menu-item-img + span,
& > .ant-menu-submenu > .ant-menu-submenu-title .sider-menu-item-img + span {
max-width: 0;
display: inline-block;
opacity: 0;
}
}
.ant-menu-item .sider-menu-item-img + span,
.ant-menu-submenu-title .sider-menu-item-img + span {
transition: opacity .3s @ease-in-out, width .3s @ease-in-out;
opacity: 1;
}
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment