Skip to content

Commit 3686099

Browse files
authored
resizer-fixes (#10454)
* feat(resizer): replace hidden with disabled and add border option Rename the Resizer prop "hidden" to "disabled" to clarify that the component is still rendered but should not perform resizing behavior. Update all internal checks and class bindings to use disabled so the component ignores pointer interactions and skip applying size changes when appropriate. Introduce `showBorder` (default: false) to optionally display a visual border on the resizer. Currently, resizers align with element edges that have border lines, but those edges are not actually resizable. Rename dragging state to isResizing for clearer intent and update bindings and event handlers accordingly. We have a global class `draggable` that overlaps in this component * fix(drawer): use updated resizer with a border line * fix: non-full-height resizers Was unable to resize new and lanes with the content that doesn’t take full height. ![Screenshot 2025-09-26 at 12.25.26.png](https://app.gitbutler.com/uploads/70fe7b8d-807d-40a9-a6bc-273b18497675) * fix(stack view): use new resizer "showBorder" prop * fix(codegenpage): use new resizer "showBorder" prop * fix(branhesView): use new resizer "ShowBorder" prop remove duplicated code
1 parent 7eb5331 commit 3686099

File tree

6 files changed

+74
-36
lines changed

6 files changed

+74
-36
lines changed

apps/desktop/src/components/BranchesView.svelte

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@
378378
viewport={branchColumn}
379379
persistId="branches-branch-column-1"
380380
direction="right"
381+
showBorder
381382
defaultValue={20}
382383
minWidth={10}
383384
maxWidth={30}
@@ -388,14 +389,6 @@
388389
<div class="commit-column" bind:this={commitColumn} class:non-local-pr={isNonLocalPr}>
389390
{#if current.commitId}
390391
<UnappliedCommitView {projectId} commitId={current.commitId} />
391-
<Resizer
392-
viewport={commitColumn}
393-
persistId="branches-branch-column-2"
394-
direction="right"
395-
defaultValue={20}
396-
minWidth={10}
397-
maxWidth={30}
398-
/>
399392
{:else if current.branchName}
400393
{#if current.inWorkspace && current.stackId}
401394
<BranchView
@@ -416,17 +409,19 @@
416409
{onerror}
417410
/>
418411
{/if}
419-
<Resizer
420-
viewport={commitColumn}
421-
persistId="branches-branch-column-2"
422-
direction="right"
423-
defaultValue={20}
424-
minWidth={10}
425-
maxWidth={30}
426-
/>
427412
{:else if current.prNumber}
428413
<PrBranchView {projectId} prNumber={current.prNumber} {onerror} />
429414
{/if}
415+
416+
<Resizer
417+
viewport={commitColumn}
418+
persistId="branches-branch-column-2"
419+
showBorder
420+
direction="right"
421+
defaultValue={20}
422+
minWidth={10}
423+
maxWidth={30}
424+
/>
430425
</div>
431426
{/if}
432427

@@ -493,7 +488,6 @@
493488
flex-shrink: 0;
494489
flex-direction: column;
495490
max-height: 100%;
496-
border-right: 1px solid var(--clr-border-2);
497491
border-left: 1px solid var(--clr-border-2);
498492
}
499493
@@ -505,7 +499,6 @@
505499
flex-direction: column;
506500
max-height: 100%;
507501
overflow: hidden;
508-
border-right: 1px solid var(--clr-border-2);
509502
510503
&.non-local-pr {
511504
flex-grow: 1;

apps/desktop/src/components/Drawer.svelte

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
bind:this={containerDiv}
8080
bind:clientHeight
8181
class:collapsed={$collapsed}
82-
class:bottom-border={bottomBorder}
82+
class:bottom-border={bottomBorder && !resizer}
8383
class:transparent
8484
class:grow
8585
class:noshrink
@@ -164,8 +164,9 @@
164164
viewport={containerDiv}
165165
defaultValue={undefined}
166166
passive={resizer.passive}
167-
hidden={$collapsed}
167+
disabled={$collapsed}
168168
direction="down"
169+
showBorder
169170
{...resizer}
170171
{maxHeight}
171172
/>

apps/desktop/src/components/Resizer.svelte

Lines changed: 52 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@
2929
minHeight?: number;
3030
/** Enabled, but does not set the width/height on the dom element */
3131
passive?: boolean;
32-
/** Whether the resizer is hidden */
33-
hidden?: boolean;
32+
/** Whether the resizer is disabled */
33+
disabled?: boolean;
34+
/** Whether to show the resizer border */
35+
showBorder?: boolean;
3436
/** Optional manager that can coordinate multiple resizers */
3537
resizeGroup?: ResizeGroup;
3638
/** Optional ordering of resizer for use with `resizeManager` */
@@ -58,7 +60,8 @@
5860
syncName,
5961
persistId,
6062
passive,
61-
hidden,
63+
disabled,
64+
showBorder = false,
6265
resizeGroup,
6366
order,
6467
unsetMaxHeight,
@@ -82,7 +85,7 @@
8285
const resizerId = Symbol();
8386
8487
let initial = 0;
85-
let dragging = $state(false);
88+
let isResizing = $state(false);
8689
let resizerDiv = $state<HTMLDivElement>();
8790
8891
let unsubUp: () => void;
@@ -128,7 +131,7 @@
128131
}
129132
130133
function onMouseMove(e: MouseEvent) {
131-
dragging = true;
134+
isResizing = true;
132135
let offsetPx: number | undefined;
133136
switch (direction) {
134137
case 'down':
@@ -159,19 +162,19 @@
159162
160163
const { newValue, overflow } = applyLimits(offsetRem);
161164
162-
if (newValue && !passive && !hidden) {
165+
if (newValue && !passive && !disabled) {
163166
setValue(newValue);
164167
}
165168
if (overflow) {
166169
onOverflow?.(overflow);
167170
}
168-
if (e.shiftKey && syncName && newValue !== undefined && !passive && !hidden) {
171+
if (e.shiftKey && syncName && newValue !== undefined && !passive && !disabled) {
169172
resizeSync.emit(syncName, resizerId, newValue);
170173
}
171174
}
172175
173176
function onMouseUp() {
174-
dragging = false;
177+
isResizing = false;
175178
unsubUp?.();
176179
unsubMove?.();
177180
onResizing?.(false);
@@ -186,7 +189,7 @@
186189
if (!viewport) {
187190
return;
188191
}
189-
if (passive || hidden) {
192+
if (passive || disabled) {
190193
if (orientation === 'horizontal') {
191194
viewport.style.width = '';
192195
viewport.style.maxWidth = '';
@@ -297,15 +300,16 @@
297300
setValue(defaultValue);
298301
}}
299302
{onclick}
300-
class:hidden
303+
class:disabled
301304
class="resizer"
302-
class:dragging
305+
class:is-resizing={isResizing}
303306
class:vertical={orientation === 'vertical'}
304307
class:horizontal={orientation === 'horizontal'}
305308
class:up={direction === 'up'}
306309
class:down={direction === 'down'}
307310
class:left={direction === 'left'}
308311
class:right={direction === 'right'}
312+
class:border={showBorder}
309313
style:z-index={zIndex}
310314
></div>
311315

@@ -331,6 +335,42 @@
331335
height: var(--resizer-thickness);
332336
}
333337
338+
&.border.horizontal::after {
339+
position: absolute;
340+
top: 0;
341+
width: 1px;
342+
height: 100%;
343+
border-left: 1px solid var(--clr-border-2);
344+
content: '';
345+
pointer-events: none;
346+
}
347+
348+
&.border.horizontal.left::after {
349+
left: 0;
350+
}
351+
352+
&.border.horizontal.right::after {
353+
right: 0;
354+
}
355+
356+
&.border.vertical::after {
357+
position: absolute;
358+
left: 0;
359+
width: 100%;
360+
height: 1px;
361+
border-top: 1px solid var(--clr-border-2);
362+
content: '';
363+
pointer-events: none;
364+
}
365+
366+
&.border.vertical.up::after {
367+
top: 0;
368+
}
369+
370+
&.border.vertical.down::after {
371+
bottom: 0;
372+
}
373+
334374
&.right {
335375
right: 0;
336376
}
@@ -344,7 +384,7 @@
344384
bottom: 0;
345385
}
346386
347-
&.hidden {
387+
&.disabled {
348388
pointer-events: none;
349389
--resizer-cursor: default;
350390
}

apps/desktop/src/components/StackDraft.svelte

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
class="draft-stack"
4141
style:width={uiState.global.stackWidth.current + 'rem'}
4242
>
43-
<ConfigurableScrollableContainer>
43+
<ConfigurableScrollableContainer childrenWrapHeight="100%">
4444
<div class="draft-stack__scroll-wrap">
4545
<div class="new-commit-view">
4646
<NewCommitView {projectId} />
@@ -68,7 +68,6 @@
6868
defaultValue={23}
6969
minWidth={16}
7070
maxWidth={64}
71-
syncName="panel1"
7271
/>
7372
</div>
7473
</ConfigurableScrollableContainer>
@@ -80,11 +79,13 @@
8079
position: relative;
8180
flex-shrink: 0;
8281
flex-direction: column;
82+
min-height: 100%;
8383
border-right: 1px solid var(--clr-border-2);
8484
animation: appear-in 0.2s ease-in-out forwards;
8585
}
8686
.draft-stack__scroll-wrap {
8787
position: relative;
88+
min-height: 100%;
8889
padding: 12px;
8990
}
9091
.new-commit-view {

apps/desktop/src/components/StackView.svelte

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,7 @@
578578
viewport={stackViewEl!}
579579
zIndex="var(--z-lifted)"
580580
direction="right"
581+
showBorder={!isDetailsViewOpen}
581582
minWidth={RESIZER_CONFIG.panel1.minWidth}
582583
maxWidth={RESIZER_CONFIG.panel1.maxWidth}
583584
defaultValue={RESIZER_CONFIG.panel1.defaultValue}
@@ -663,6 +664,7 @@
663664
viewport={compactDiv!}
664665
persistId="resizer-panel2-${stackId}"
665666
direction="right"
667+
showBorder
666668
minWidth={RESIZER_CONFIG.panel2.minWidth}
667669
maxWidth={RESIZER_CONFIG.panel2.maxWidth}
668670
defaultValue={RESIZER_CONFIG.panel2.defaultValue}
@@ -679,7 +681,7 @@
679681
flex-shrink: 0;
680682
height: 100%;
681683
overflow: hidden;
682-
border-right: 1px solid var(--clr-border-2);
684+
/* border-right: 1px solid var(--clr-border-2); */
683685
transition: opacity 0.15s;
684686
685687
&.dimmed {
@@ -696,6 +698,7 @@
696698
position: relative;
697699
flex-shrink: 0;
698700
flex-direction: column;
701+
min-height: 100%;
699702
padding: 0 12px;
700703
701704
/* Use CSS custom properties for details view width to avoid ResizeObserver errors */

apps/desktop/src/components/codegen/CodegenPage.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,7 @@
802802
<Resizer
803803
direction="left"
804804
viewport={rightSidebarRef}
805+
showBorder
805806
defaultValue={24}
806807
minWidth={20}
807808
maxWidth={35}
@@ -1150,7 +1151,6 @@
11501151
position: relative;
11511152
flex-direction: column;
11521153
height: 100%;
1153-
border-left: 1px solid var(--clr-border-2);
11541154
}
11551155
11561156
.right-sidebar__placeholder {

0 commit comments

Comments
 (0)