Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a2718a2

Browse files
author
Antonio Scandurra
committed
🎨 Inline render{Push,Pull}Button
1 parent b2976f7 commit a2718a2

File tree

1 file changed

+12
-18
lines changed

1 file changed

+12
-18
lines changed

lib/git/push-pull/push-pull-component.js

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,14 @@ export default class PushPullComponent {
9292
<button className='git-PushPull-item btn' onclick={() => this.fetch()} disabled={this.viewModel.hasRequestsInFlight()}>Fetch</button>
9393

9494
<div className='git-PushPull-item is-flexible btn-group'>
95-
{this.renderPullButton()}
96-
{this.renderPushButton()}
95+
<button className='btn' onclick={() => this.pull()} disabled={this.viewModel.hasRequestsInFlight()}>
96+
<span className='icon icon-arrow-down'/>
97+
{this.labelForPullButton()}
98+
</button>
99+
<button className='btn' onclick={() => this.push()} disabled={this.viewModel.hasRequestsInFlight()}>
100+
<span className='icon icon-arrow-up'/>
101+
{this.labelForPushButton()}
102+
</button>
97103
</div>
98104
</div>
99105
{this.renderProgress()}
@@ -103,24 +109,12 @@ export default class PushPullComponent {
103109
/*eslint-enable*/
104110
}
105111

106-
renderPushButton () {
107-
let label = this.viewModel.getAheadCount() === 0 ? 'Push' : `Push (${this.viewModel.getAheadCount()})`
108-
return (
109-
<button className='btn' onclick={() => this.push()} disabled={this.viewModel.hasRequestsInFlight()}>
110-
<span className='icon icon-arrow-up'/>
111-
{label}
112-
</button>
113-
)
112+
labelForPullButton () {
113+
return this.viewModel.getBehindCount() === 0 ? 'Pull' : `Pull (${this.viewModel.getBehindCount()})`
114114
}
115115

116-
renderPullButton () {
117-
let label = this.viewModel.getBehindCount() === 0 ? 'Pull' : `Pull (${this.viewModel.getBehindCount()})`
118-
return (
119-
<button className='btn' onclick={() => this.pull()} disabled={this.viewModel.hasRequestsInFlight()}>
120-
<span className='icon icon-arrow-down'/>
121-
{label}
122-
</button>
123-
)
116+
labelForPushButton () {
117+
return this.viewModel.getAheadCount() === 0 ? 'Push' : `Push (${this.viewModel.getAheadCount()})`
124118
}
125119

126120
async performOperation (fn: () => Promise<void>): Promise<void> {

0 commit comments

Comments
 (0)