forked from atom/github
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathremote-configuration-view.js
84 lines (77 loc) · 2.81 KB
/
remote-configuration-view.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import React from 'react';
import PropTypes from 'prop-types';
import cx from 'classnames';
import {TabbableInput, TabbableSummary, TabbableTextEditor} from './tabbable';
export default class RemoteConfigurationView extends React.Component {
static propTypes = {
tabGroup: PropTypes.object.isRequired,
currentProtocol: PropTypes.oneOf(['https', 'ssh']),
sourceRemoteBuffer: PropTypes.object.isRequired,
didChangeProtocol: PropTypes.func.isRequired,
// Atom environment
commands: PropTypes.object.isRequired,
}
render() {
const httpsClassName = cx(
'github-RemoteConfiguration-protocolOption',
'github-RemoteConfiguration-protocolOption--https',
'input-label',
);
const sshClassName = cx(
'github-RemoteConfiguration-protocolOption',
'github-RemoteConfiguration-protocolOption--ssh',
'input-label',
);
return (
<details className="github-RemoteConfiguration-details block">
<TabbableSummary tabGroup={this.props.tabGroup} commands={this.props.commands}>Advanced</TabbableSummary>
<main>
<div className="github-RemoteConfiguration-protocol block">
<span className="github-RemoteConfiguration-protocolHeading">Protocol:</span>
<label className={httpsClassName}>
<TabbableInput
tabGroup={this.props.tabGroup}
commands={this.props.commands}
className="input-radio"
type="radio"
name="protocol"
value="https"
checked={this.props.currentProtocol === 'https'}
onChange={this.handleProtocolChange}
/>
HTTPS
</label>
<label className={sshClassName}>
<TabbableInput
tabGroup={this.props.tabGroup}
commands={this.props.commands}
className="input-radio"
type="radio"
name="protocol"
value="ssh"
checked={this.props.currentProtocol === 'ssh'}
onChange={this.handleProtocolChange}
/>
SSH
</label>
</div>
<div className="github-RemoteConfiguration-sourceRemote block">
<label className="input-label">Source remote name:
<TabbableTextEditor
tabGroup={this.props.tabGroup}
commands={this.props.commands}
className="github-RemoteConfiguration-sourceRemoteName"
mini={true}
autoWidth={false}
buffer={this.props.sourceRemoteBuffer}
/>
</label>
</div>
</main>
</details>
);
}
handleProtocolChange = event => {
this.props.didChangeProtocol(event.target.value);
}
}