Skip to content

Commit 364d5d1

Browse files
committed
feat(nx-dev): increase section group items
1 parent 32d63cb commit 364d5d1

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

nx-dev/ui-common/src/lib/sidebar.tsx

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ function SidebarSection({
9696
key={item.id + '-' + index}
9797
item={item}
9898
isNested={false}
99+
firstLevel={false} // Not needed at the top level
99100
isInTechnologiesPath={isTechnologiesItem}
100101
/>
101102
</div>
@@ -111,10 +112,12 @@ function SidebarSectionItems({
111112
item,
112113
isNested = false,
113114
isInTechnologiesPath = false,
115+
firstLevel = false,
114116
}: {
115117
item: MenuItem;
116118
isNested?: boolean;
117119
isInTechnologiesPath?: boolean;
120+
firstLevel?: boolean;
118121
}): JSX.Element {
119122
const router = useRouter();
120123
const [collapsed, setCollapsed] = useState(!item.disableCollapsible);
@@ -123,7 +126,8 @@ function SidebarSectionItems({
123126
const isTechnologiesItem = item.id === 'technologies';
124127

125128
// If this is direct child of the Technologies item, show an icon
126-
const isDirectTechnologyChild = isInTechnologiesPath;
129+
const isDirectTechnologyChild =
130+
isInTechnologiesPath && item.id !== 'technologies';
127131

128132
// Get the icon key for this technology
129133
let iconKey = null;
@@ -152,10 +156,10 @@ function SidebarSectionItems({
152156
data-testid={`section-h5:${item.id}`}
153157
className={cx(
154158
'group flex items-center py-2',
155-
isDirectTechnologyChild
156-
? '-ml-1 rounded-md px-1 hover:bg-slate-50 dark:hover:bg-slate-800/60'
157-
: '',
158-
'text-sm font-semibold text-slate-800 lg:text-sm dark:text-slate-200',
159+
isDirectTechnologyChild ? '-ml-1 px-1 ' : '',
160+
!isNested
161+
? 'text-base font-semibold text-slate-800 lg:text-base dark:text-slate-200'
162+
: 'text-sm font-semibold text-slate-800 lg:text-sm dark:text-slate-200',
159163
item.disableCollapsible ? 'cursor-text' : 'cursor-pointer'
160164
)}
161165
onClick={handleCollapseToggle}
@@ -199,13 +203,17 @@ function SidebarSectionItems({
199203
handleCollapseToggle();
200204
}
201205

206+
// Skip pl-3 for first level items, apply it to deeper nested levels
207+
const shouldApplyPadding = isNested && !firstLevel;
208+
202209
return (
203210
<li
204211
key={subItem.id + '-' + index}
205212
data-testid={`section-li:${subItem.id}`}
206213
className={cx(
207-
'relative pl-3',
208-
!isNested && 'transition-colors duration-150',
214+
'relative',
215+
shouldApplyPadding && 'pl-3', // Only apply padding for deeply nested items, not first level
216+
!isNested && 'pl-2 transition-colors duration-150', // Add pl-2 for padding between vertical bar and text
209217
!isNested && 'border-l-2',
210218
!isNested &&
211219
(isActiveLink
@@ -217,6 +225,7 @@ function SidebarSectionItems({
217225
<SidebarSectionItems
218226
item={subItem}
219227
isNested={true}
228+
firstLevel={!isNested} // Set firstLevel=true when coming from a top-level item
220229
isInTechnologiesPath={isTechnologiesItem}
221230
/>
222231
) : (

0 commit comments

Comments
 (0)