Skip to content

Commit cafae6f

Browse files
authored
style(sidebar): make hover full-width and add clearer item spacing (#8158)
1 parent 1ad4c03 commit cafae6f

File tree

2 files changed

+37
-15
lines changed

2 files changed

+37
-15
lines changed

packages/ui-components/src/Containers/Sidebar/SidebarGroup/index.module.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66
flex-col
77
gap-2;
88

9+
/* Default item list spacing for non-progression groups */
10+
.itemList {
11+
@apply flex
12+
flex-col
13+
gap-1;
14+
}
15+
916
&:not(.progression) {
1017
.groupName {
1118
@apply px-2

packages/ui-components/src/Containers/Sidebar/SidebarItem/index.module.css

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,21 @@
77
flex
88
w-full
99
items-center
10+
gap-1
1011
overflow-hidden
1112
rounded-md
1213
text-sm
1314
text-neutral-800
1415
dark:text-neutral-200;
1516

16-
&:hover {
17-
&:not(.progression) .label {
18-
/* @see https://github.com/nodejs/nodejs.org/blob/main/packages/ui-components/src/Containers/NavBar/NavItem/index.module.css#L24 */
19-
@apply rounded-sm
20-
bg-neutral-100
21-
text-neutral-900
22-
dark:bg-neutral-900
17+
&:not(.active):hover {
18+
/* Apply hover background to the full item width */
19+
@apply bg-neutral-100
20+
dark:bg-neutral-900;
21+
22+
/* Ensure text colors contrast with hover background */
23+
.label {
24+
@apply text-neutral-900
2325
dark:text-neutral-100;
2426
}
2527

@@ -64,25 +66,38 @@
6466
@apply p-1;
6567
}
6668

67-
&:not(.active):hover .label {
68-
@apply rounded-sm
69-
bg-neutral-100
69+
/* On hover, use full-width background on the item (set above) */
70+
&:not(.active):hover {
71+
@apply bg-neutral-100
7072
dark:bg-neutral-900;
7173
}
74+
75+
/* Avoid extra pill background on the label when hovering */
76+
&:not(.active):hover .label {
77+
@apply rounded-none
78+
bg-transparent;
79+
}
7280
}
7381

7482
&.active {
75-
@apply text-neutral-900
76-
dark:text-white;
83+
/* Full-width active background and readable text */
84+
@apply bg-green-600
85+
text-white;
7786

7887
.progressionIcon {
7988
@apply fill-green-500;
8089
}
8190

82-
&:not(.progression) .label {
83-
@apply rounded-sm
84-
bg-green-600
91+
/* Remove pill background on the label; keep full-width bg on the item */
92+
.label {
93+
@apply rounded-none
94+
bg-transparent
8595
text-white;
8696
}
97+
98+
/* Preserve active background on hover */
99+
&:hover {
100+
@apply bg-green-600;
101+
}
87102
}
88103
}

0 commit comments

Comments
 (0)