Skip to content

Commit

Permalink
absorb: add scroll bars for the main content
Browse files Browse the repository at this point in the history
Summary:
The diff to absorb could exceed the window size. Add a scrollbar for long
content.

Reviewed By: zzl0

Differential Revision: D67959264

fbshipit-source-id: ee9ff25761079e86f40f857198ec230a67fa0a2b
  • Loading branch information
quark-zju authored and facebook-github-bot committed Jan 9, 2025
1 parent c922b44 commit 8913d6f
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions addons/isl/src/stackEdit/ui/AbsorbStackEditPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import type {CommitStackState, FileStackIndex, Rev} from '../commitStackState';
import type {Map as ImMap} from 'immutable';

import {FileHeader, IconType} from '../../ComparisonView/SplitDiffView/SplitDiffFileHeader';
import {ScrollY} from '../../ComponentUtils';
import {DragHandle} from '../../DragHandle';
import {DraggingOverlay} from '../../DraggingOverlay';
import {defaultRenderGlyph, RenderDag} from '../../RenderDag';
Expand Down Expand Up @@ -99,6 +100,9 @@ const styles = stylex.create({
instruction: {
padding: 'var(--halfpad) var(--pad)',
},
scrollYPadding: {
paddingRight: 'var(--pad)',
},
});

/** The `AbsorbEdit` that is currently being dragged. */
Expand Down Expand Up @@ -126,18 +130,20 @@ export function AbsorbStackEditPanel() {
</div>
</Row>
</div>
<RenderDag
className="absorb-dag"
dag={dag}
renderCommit={renderCommit}
renderCommitExtras={renderCommitExtras}
renderGlyph={RenderGlyph}
subset={subset}
style={{
/* make it "containing block" so findDragDestinationCommitKey works */
position: 'relative',
}}
/>
<ScrollY maxSize="calc(100vh - 200px)" {...stylex.props(styles.scrollYPadding)}>
<RenderDag
className="absorb-dag"
dag={dag}
renderCommit={renderCommit}
renderCommitExtras={renderCommitExtras}
renderGlyph={RenderGlyph}
subset={subset}
style={{
/* make it "containing block" so findDragDestinationCommitKey works */
position: 'relative',
}}
/>
</ScrollY>
</Column>
<AbsorbDraggingOverlay />
</>
Expand Down

0 comments on commit 8913d6f

Please sign in to comment.