Skip to content

Commit b81b31b

Browse files
Merge pull request #29 from Spherre-Labs/fix
fix sidemenu icon size bug
2 parents d6ead11 + 3be349f commit b81b31b

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

frontend/app/dapp/Sidebar.tsx

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,8 @@ const Sidebar = () => {
6767
return (
6868
<aside
6969
id="sidebar"
70-
className={`fixed top-0 left-0 h-screen bg-[#1c1d1f] text-white border-r-[1px] border-gray-600 transition-all duration-300 z-10 ${
71-
expanded ? 'w-64' : 'w-16'
72-
}`}
70+
className={`fixed top-0 left-0 h-screen bg-[#1c1d1f] text-white border-r-[1px] border-gray-600 transition-all duration-300 z-10 ${expanded ? 'w-64' : 'w-16'
71+
}`}
7372
onMouseEnter={() => setExpanded(true)}
7473
onMouseLeave={() => setExpanded(false)}
7574
>
@@ -93,22 +92,35 @@ const Sidebar = () => {
9392
<li
9493
key={item.name}
9594
onClick={() => handleNavClick(item.name)}
96-
className={`flex items-center cursor-pointer p-3 rounded-lg transition-all ${
97-
expanded ? 'gap-3' : 'justify-center'
98-
} ${
99-
activePage === item.name
95+
className={`flex items-center cursor-pointer p-3 rounded-lg transition-all ${expanded ? 'gap-3' : 'justify-center'
96+
} ${activePage === item.name
10097
? 'bg-[#27292D] text-white'
10198
: 'text-gray-400'
102-
}`}
99+
}`}
100+
style={{
101+
width: expanded ? 'auto' : '40px', // Ensure enough space for icons when collapsed
102+
height: '40px', // Fixed height for consistency
103+
}}
103104
>
104-
<div className="relative">
105+
<div
106+
className="relative flex items-center justify-center"
107+
style={{
108+
width: expanded ? 'auto' : '40px', // Adjust width for collapsed state
109+
height: '40px', // Fixed height for icons
110+
}}
111+
>
105112
<Image
106113
src={item.icon}
107114
alt={item.name}
108-
width={expanded ? 24 : 40}
109-
height={expanded ? 24 : 40}
115+
width={expanded ? 24 : 30} // Dynamically adjust icon size
116+
height={expanded ? 24 : 30} // Dynamically adjust icon size
117+
className="transition-all duration-300" // Smooth transition for size changes
110118
/>
111-
{item.notification}
119+
{item.notification && expanded && (
120+
<span className="absolute top-0 right-0 text-[10px] bg-red-500 text-white rounded-full px-1">
121+
{item.notification}
122+
</span>
123+
)}
112124
</div>
113125

114126
{expanded && (

0 commit comments

Comments
 (0)