Skip to content

Commit 3889c83

Browse files
committed
fix the collapse buttom and the items when sidebar is collapsed
1 parent 9dbbb14 commit 3889c83

File tree

1 file changed

+41
-70
lines changed

1 file changed

+41
-70
lines changed

frontend/src/components/Sidebar.css

Lines changed: 41 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -34,108 +34,66 @@
3434
50% { background-position: -200% 0; }
3535
}
3636

37+
.sidebar {
38+
--sidebar-width: 17rem;
39+
}
40+
3741
.sidebar--collapsed {
3842
width: 4.5rem;
43+
--sidebar-width: 4.5rem;
3944
}
4045

4146
.sidebar--expanded {
4247
width: 17rem;
48+
--sidebar-width: 17rem;
4349
}
4450

45-
/* Header Section */
46-
.sidebar__header {
47-
padding: 2rem 1.5rem;
48-
display: flex;
49-
align-items: center;
50-
justify-content: space-between;
51-
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
52-
background: rgba(0, 0, 0, 0.2);
53-
position: relative;
54-
}
5551

56-
.sidebar__header::after {
57-
content: '';
58-
position: absolute;
59-
bottom: 0;
60-
left: 50%;
61-
transform: translateX(-50%);
62-
width: 60%;
63-
height: 1px;
64-
background: linear-gradient(90deg, transparent, #3b82f6, transparent);
65-
}
66-
67-
.sidebar__title {
68-
font-size: 1.4rem;
69-
font-weight: 800;
70-
color: #f8fafc;
71-
display: flex;
72-
align-items: center;
73-
gap: 0.75rem;
74-
margin: 0;
75-
text-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
76-
}
77-
78-
.sidebar__title-icon {
79-
width: 1.75rem;
80-
height: 1.75rem;
81-
color: #60a5fa;
82-
filter: drop-shadow(0 0 8px rgba(96, 165, 250, 0.4));
83-
}
8452

8553
.sidebar__toggle {
86-
padding: 0.75rem;
87-
background: linear-gradient(135deg, #374151, #4b5563);
54+
padding: 0.25rem;
55+
background: rgba(255, 255, 255, 0.1);
8856
color: #e5e7eb;
89-
border: 1px solid rgba(255, 255, 255, 0.1);
90-
border-radius: 50%;
57+
border: none;
58+
border-radius: 6px;
9159
cursor: pointer;
92-
transition: all 0.3s ease;
60+
transition: all 0.2s ease;
9361
display: flex;
9462
align-items: center;
9563
justify-content: center;
96-
position: relative;
97-
overflow: auto;
98-
}
99-
100-
.sidebar__toggle::before {
101-
content: '';
10264
position: absolute;
103-
top: 50%;
104-
left: 50%;
105-
width: 0;
106-
height: 0;
107-
background: radial-gradient(circle, rgba(59, 130, 246, 0.3) 0%, transparent 70%);
108-
transition: all 0.3s ease;
109-
transform: translate(-50%, -50%);
110-
}
111-
112-
.sidebar__toggle:hover::before {
113-
width: 100px;
114-
height: 100px;
65+
top: 1rem;
66+
right: 1rem;
67+
width: 1.5rem;
68+
height: 1.5rem;
69+
z-index: 100;
11570
}
11671

11772
.sidebar__toggle:hover {
118-
background: linear-gradient(135deg, #4b5563, #6b7280);
73+
background: rgba(255, 255, 255, 0.2);
11974
color: #f8fafc;
120-
transform: rotate(180deg);
12175
}
12276

12377
.sidebar__toggle-icon {
124-
width: 1.25rem;
125-
height: 1.25rem;
126-
z-index: 1;
78+
width: 0.875rem;
79+
height: 0.875rem;
12780
}
12881

12982
/* Navigation */
13083
.sidebar__nav {
13184
flex: 1;
132-
padding: 1.5rem 1rem;
85+
padding: 3rem 1rem 1.5rem 1rem;
13386
display: flex;
13487
flex-direction: column;
135-
gap: 0.5rem;
88+
gap: 0.25rem;
13689
position: relative;
13790
}
13891

92+
.sidebar--collapsed .sidebar__nav {
93+
padding: 3rem 0.5rem 1.5rem 0.5rem;
94+
gap: 0.125rem;
95+
}
96+
13997
.sidebar__nav::before {
14098
content: '';
14199
position: absolute;
@@ -213,7 +171,11 @@
213171

214172
.sidebar__nav-item--collapsed {
215173
justify-content: center;
216-
padding: 1rem 0.5rem;
174+
padding: 0.75rem;
175+
margin: 0.25rem;
176+
border-radius: 8px;
177+
min-height: 2.5rem;
178+
width: calc(100% - 0.5rem);
217179
}
218180

219181
.sidebar__nav-icon {
@@ -223,6 +185,11 @@
223185
filter: drop-shadow(0 0 4px rgba(59, 130, 246, 0.2));
224186
}
225187

188+
.sidebar--collapsed .sidebar__nav-icon {
189+
width: 1.25rem;
190+
height: 1.25rem;
191+
}
192+
226193
.sidebar__nav-label {
227194
margin-left: 1rem;
228195
font-size: 0.9rem;
@@ -273,7 +240,11 @@
273240

274241
.sidebar__logout--collapsed {
275242
justify-content: center;
276-
padding: 1rem 0.5rem;
243+
padding: 0.75rem;
244+
margin: 0.25rem 1rem;
245+
border-radius: 8px;
246+
min-height: 2.5rem;
247+
width: calc(100% - 2.5rem);
277248
}
278249

279250
.sidebar__logout-icon {

0 commit comments

Comments
 (0)