A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/markerikson/project-minimek/commit/dad0aa71cbb090e3575f351ac54c3d90a20b8ab2 below:

Use more generic onChange handlers for PilotDetails dropdowns and inputs · markerikson/project-minimek@dad0aa7 · GitHub

File tree Expand file treeCollapse file tree 1 file changed

+9

-5

lines changed

Filter options

Expand file treeCollapse file tree 1 file changed

+9

-5

lines changed Original file line number Diff line number Diff line change

@@ -70,15 +70,16 @@ const actions = {

70 70 71 71 72 72

export class PilotDetails extends Component {

73 -

onNameChanged = (e) => {

73 +

onInputChanged = (e) => {

74 74

const newValues = getValueFromEvent(e);

75 75

const {id} = this.props.pilot;

76 76 77 77

this.props.updateEntity("Pilot", id, newValues);

78 78

}

79 79 80 -

onRankChanged = (e, result) => {

81 -

const newValues = {rank : result.value};

80 +

onDropdownChanged = (e, result) => {

81 +

const {name, value} = result;

82 +

const newValues = { [name] : value};

82 83

const {id} = this.props.pilot;

83 84 84 85

this.props.updateEntity("Pilot", id, newValues);

@@ -109,7 +110,7 @@ export class PilotDetails extends Component {

109 110

placeholder="Name"

110 111

value={name}

111 112

disabled={!canStopEditing}

112 -

onChange={this.onNameChanged}

113 +

onChange={this.onInputChanged}

113 114

control="input"

114 115

/>

115 116

<Form.Field

@@ -121,7 +122,7 @@ export class PilotDetails extends Component {

121 122

selection

122 123

options={RANKS}

123 124

value={rank}

124 -

onChange={this.onRankChanged}

125 +

onChange={this.onDropdownChanged}

125 126

disabled={!canStopEditing}

126 127

/>

127 128

<Form.Field

@@ -131,6 +132,7 @@ export class PilotDetails extends Component {

131 132

placeholder="Age"

132 133

control="input"

133 134

value={age}

135 +

onChange={this.onInputChanged}

134 136

disabled={!canStopEditing}

135 137

/>

136 138

<Form.Field

@@ -142,6 +144,7 @@ export class PilotDetails extends Component {

142 144

selection

143 145

options={SKILL_VALUES}

144 146

value={gunnery}

147 +

onChange={this.onDropdownChanged}

145 148

disabled={!canStopEditing}

146 149

/>

147 150

<Form.Field

@@ -153,6 +156,7 @@ export class PilotDetails extends Component {

153 156

selection

154 157

options={SKILL_VALUES}

155 158

value={piloting}

159 +

onChange={this.onDropdownChanged}

156 160

disabled={!canStopEditing}

157 161

/>

158 162

<Form.Field

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4