Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 41 additions & 26 deletions lib/views/file-patch-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,32 +67,47 @@ export default class FilePatchView {
<div className="github-FilePatchView" tabIndex="-1"
onmouseup={this.mouseup}
style={`font-size: ${this.fontSize}px`}>
{this.props.hunks.map(hunk => {
const isSelected = selectedHunks.has(hunk);
let stageButtonSuffix = (hunkSelectionMode || !isSelected) ? ' Hunk' : ' Selection';
if (selectedHunks.size > 1 && selectedHunks.has(hunk)) {
stageButtonSuffix += 's';
}
const stageButtonLabel = stageButtonLabelPrefix + stageButtonSuffix;

return (
<HunkView
key={hunk.getHeader()}
hunk={hunk}
isSelected={selectedHunks.has(hunk)}
hunkSelectionMode={hunkSelectionMode}
stageButtonLabel={stageButtonLabel}
selectedLines={selectedLines}
headLine={headLine}
headHunk={headHunk}
mousedownOnHeader={() => this.mousedownOnHeader(hunk)}
mousedownOnLine={this.mousedownOnLine}
mousemoveOnLine={this.mousemoveOnLine}
didClickStageButton={() => this.didClickStageButtonForHunk(hunk)}
registerView={this.props.registerHunkView}
/>
);
})}

<header className="github-FilePatchView-header">
<span className="github-FilePatchView-title">file-name.js</span>
<label className="github-FilePatchView-toggle">
<input className='input-toggle' type='checkbox' />
Line Mode
</label>
<span className='btn-group'>
<button className='btn icon icon-tasklist'></button>
<button className='btn icon icon-code'></button>
</span>
</header>

<main className="github-FilePatchView-container">
{this.props.hunks.map(hunk => {
const isSelected = selectedHunks.has(hunk);
let stageButtonSuffix = (hunkSelectionMode || !isSelected) ? ' Hunk' : ' Selection';
if (selectedHunks.size > 1 && selectedHunks.has(hunk)) {
stageButtonSuffix += 's';
}
const stageButtonLabel = stageButtonLabelPrefix + stageButtonSuffix;

return (
<HunkView
key={hunk.getHeader()}
hunk={hunk}
isSelected={selectedHunks.has(hunk)}
hunkSelectionMode={hunkSelectionMode}
stageButtonLabel={stageButtonLabel}
selectedLines={selectedLines}
headLine={headLine}
headHunk={headHunk}
mousedownOnHeader={() => this.mousedownOnHeader(hunk)}
mousedownOnLine={this.mousedownOnLine}
mousemoveOnLine={this.mousemoveOnLine}
didClickStageButton={() => this.didClickStageButtonForHunk(hunk)}
registerView={this.props.registerHunkView}
/>
);
})}
</main>
</div>
);
}
Expand Down
20 changes: 20 additions & 0 deletions styles/file-patch-view.less
Original file line number Diff line number Diff line change
@@ -1,7 +1,27 @@
@import "variables";

.github-FilePatchView {
display: flex;
flex-direction: column;
-webkit-user-select: none;
cursor: default;
flex: 1;

&-header {
display: flex;
justify-content: space-between;
padding: @component-padding/2;
padding-left: @component-padding;
border-bottom: 1px solid @base-border-color;
}

&-toggle .input-toggle {
margin-left: .5em;
margin-right: .5em;
}

&-container {
flex: 1;
overflow-y: auto;
}
}
1 change: 0 additions & 1 deletion styles/pane-view.less
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
@import "ui-variables";

.github-PaneView {
overflow-y: auto;
display: flex;

&.is-blank {
Expand Down