fix(sidebar): drop top margin on first worktree group header (#824)

The worktree search bar already provides spacing above the list, so the
first group header doesn't need its own mt-2 offset. Secondary headers
still get the margin to separate groups.
This commit is contained in:
Neil 2026-04-19 00:13:54 -07:00 committed by GitHub
parent 75f68a0a84
commit 0f43ab02e6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -235,6 +235,8 @@ const VirtualizedWorktreeViewport = React.memo(function VirtualizedWorktreeViewp
[navigateWorktree]
)
const firstHeaderIndex = useMemo(() => rows.findIndex((r) => r.type === 'header'), [rows])
const virtualItems = virtualizer.getVirtualItems()
const activeDescendantId =
activeWorktreeId != null &&
@ -291,7 +293,11 @@ const VirtualizedWorktreeViewport = React.memo(function VirtualizedWorktreeViewp
role="button"
tabIndex={0}
className={cn(
'group mt-2 flex h-7 w-full items-center gap-1.5 px-1.5 text-left transition-all cursor-pointer',
'group flex h-7 w-full items-center gap-1.5 px-1.5 text-left transition-all cursor-pointer',
// First header sits right under the sidebar search bar, which
// already supplies its own spacing — only offset secondary
// group headers.
vItem.index !== firstHeaderIndex && 'mt-2',
row.repo ? 'overflow-hidden' : row.tone
)}
onClick={() => toggleGroup(row.key)}