Skip to content

Commit c53ef4a

Browse files
Copilotsawka
andcommitted
fix: prevent vtabbar drop line layout jump
Co-authored-by: sawka <2722291+sawka@users.noreply.github.com>
1 parent 189338b commit c53ef4a

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

frontend/app/tab/vtabbar.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,20 @@ export function VTabBar({ tabs, activeTabId, width, className, onSelectTab, onCl
6868
onReorderTabs?.(nextTabs.map((tab) => tab.id));
6969
};
7070

71+
const getDropLineClass = (index: number) =>
72+
cn(
73+
"h-0 border-t-2",
74+
dragTabId != null && dropIndex === index ? "border-accent/80" : "border-transparent",
75+
index > 0 && index < orderedTabs.length && "my-px"
76+
);
77+
7178
return (
7279
<div
7380
className={cn("flex h-full min-w-[100px] max-w-[400px] flex-col overflow-hidden border-r border-border bg-panel", className)}
7481
style={{ width: barWidth }}
7582
>
7683
<div
77-
className="flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto p-1"
84+
className="flex min-h-0 flex-1 flex-col overflow-y-auto p-1"
7885
onDragOver={(event) => {
7986
event.preventDefault();
8087
if (event.target === event.currentTarget) {
@@ -89,9 +96,9 @@ export function VTabBar({ tabs, activeTabId, width, className, onSelectTab, onCl
8996
clearDragState();
9097
}}
9198
>
92-
{dropIndex === 0 && <div className="h-0 border-t-2 border-accent/80" />}
99+
<div className={getDropLineClass(0)} />
93100
{orderedTabs.map((tab, index) => (
94-
<div key={tab.id} className="flex flex-col gap-1">
101+
<div key={tab.id} className="flex flex-col">
95102
<VTab
96103
tab={tab}
97104
active={tab.id === activeTabId}
@@ -121,7 +128,7 @@ export function VTabBar({ tabs, activeTabId, width, className, onSelectTab, onCl
121128
}}
122129
onDragEnd={clearDragState}
123130
/>
124-
{dropIndex === index + 1 && <div className="h-0 border-t-2 border-accent/80" />}
131+
<div className={getDropLineClass(index + 1)} />
125132
</div>
126133
))}
127134
</div>

0 commit comments

Comments
 (0)