feat(sidebar): 侧边栏图标更换,默认菜单数据增加icon和activeIcon属性

master
钟良源 4 months ago
parent d3da19f695
commit af18bec033

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 935 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 932 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 813 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 931 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 824 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 861 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 763 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 401 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 407 B

@ -4,68 +4,45 @@ export const menuData1 = [
path: '', path: '',
key: 'appList', key: 'appList',
parentKey: 'appList', parentKey: 'appList',
children: [ icon: '/ideContainer/icon/appList.png',
{ activeIcon: '/ideContainer/icon/appList_active.png',
title: '应用A', children: []
path: 'compFlow',
key: 'compFlow',
parentKey: 'appList',
children: [
{
title: '事件',
children: null
},
{
title: '组件列表',
children: null
}
]
},
{
title: '应用B',
path: 'compFlow',
key: 'compFlow',
parentKey: 'appList',
children: [
{
title: '事件',
children: null
},
{
title: '组件列表',
children: null
}
]
}
]
}, },
{ {
title: '应用编排', title: '应用编排',
path: 'appFlow',
key: 'appFlow', key: 'appFlow',
parentKey: 'appFlow', parentKey: 'appFlow',
children: null, icon: '/ideContainer/icon/appFlow.png',
path: 'appFlow' activeIcon: '/ideContainer/icon/appFlow_active.png',
children: null
}, },
{ {
title: '事件', title: '事件',
children: null,
path: 'event', path: 'event',
key: 'event', key: 'event',
parentKey: 'event' parentKey: 'event',
icon: '/ideContainer/icon/appEvent.png',
activeIcon: '/ideContainer/icon/appEvent_active.png',
children: null
}, },
{ {
title: '全局参数', title: '全局参数',
children: null,
path: 'globalVar', path: 'globalVar',
key: 'globalVar', key: 'globalVar',
parentKey: 'globalVar' parentKey: 'globalVar',
icon: '/ideContainer/icon/globalVar.png',
activeIcon: '/ideContainer/icon/globalVar_active.png',
children: null
}, },
{ {
title: '组件', title: '组件',
children: null,
path: 'appCompList', path: 'appCompList',
key: 'appCompList', key: 'appCompList',
parentKey: 'appCompList' parentKey: 'appCompList',
icon: '/ideContainer/icon/appComp.png',
activeIcon: '/ideContainer/icon/appComp_active.png',
children: null
} }
]; ];

@ -412,9 +412,14 @@ const SideBar: React.FC<SideBarProps> = ({
onClick={() => handleMenuItemClick(item, index)} onClick={() => handleMenuItemClick(item, index)}
> >
<div className={styles['menu-item-content']}> <div className={styles['menu-item-content']}>
<span className={styles['menu-item-icon']}> {item.icon &&
<img src={selected.parentKey === `${item.parentKey}` ? item.activeIcon as string : item.icon as string}
style={{ width: 20, height: 20, marginBottom: 7 }} />}
{!item.icon && (
<span className={styles['menu-item-icon']}>
{item.icon || <IconApps />} {item.icon || <IconApps />}
</span> </span>
)}
<span className={styles['menu-item-text']}> <span className={styles['menu-item-text']}>
{item.title} {item.title}
</span> </span>

Loading…
Cancel
Save