diff --git a/src/components/Dashboard/common/DashboardSidebar.jsx b/src/components/Dashboard/common/DashboardSidebar.jsx
index 5461c1b9..67181982 100644
--- a/src/components/Dashboard/common/DashboardSidebar.jsx
+++ b/src/components/Dashboard/common/DashboardSidebar.jsx
@@ -1,4 +1,4 @@
-import { useState, useEffect, useContext } from 'react'
+import { cloneElement, isValidElement, useState, useEffect, useContext } from 'react'
import { Layout, Menu, Flex, Button } from 'antd'
import { CaretDownFilled } from '@ant-design/icons'
import CollapseSidebarIcon from '../../Icons/CollapseSidebarIcon'
@@ -12,8 +12,29 @@ import { getSidebarIconNode } from '../../Icons/sidebarIconMap'
import SimpleBar from 'simplebar-react'
import { useThemeContext } from '../context/ThemeContext'
import { filterSidebarItemsByListPermission } from '../../../database/Sidebars'
+import Tooltip from './Tooltip'
const { Sider } = Layout
+const CollapsedItemIcon = ({ className, icon, title }) => {
+ const iconNode = isValidElement(icon)
+ ? cloneElement(icon, {
+ className: [icon.props.className, className].filter(Boolean).join(' ')
+ })
+ : icon
+
+ return (
+
+ {iconNode ?? }
+
+ )
+}
+
+CollapsedItemIcon.propTypes = {
+ className: PropTypes.string,
+ icon: PropTypes.node,
+ title: PropTypes.node
+}
+
const DashboardSidebar = ({
items = [],
selectedKey = '',
@@ -52,9 +73,15 @@ const DashboardSidebar = ({
return item
}
+ const icon = item.icon || getSidebarIconNode(item.iconKey)
const mappedItem = {
key: item.key,
- icon: item.icon || getSidebarIconNode(item.iconKey),
+ icon:
+ collapsed && !isMobile ? (
+
+ ) : (
+ icon
+ ),
label: item.label
}