fix indent and put submit on enter
This commit is contained in:
parent
29a0d5c658
commit
c8504b0024
|
@ -19,6 +19,14 @@ class Blockchain extends React.Component {
|
||||||
this.setState({ valueSet: e.target.value });
|
this.setState({ valueSet: e.target.value });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checkEnter(e, func) {
|
||||||
|
if (e.key !== 'Enter') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
e.preventDefault();
|
||||||
|
func.apply(this, [e]);
|
||||||
|
}
|
||||||
|
|
||||||
setValue(e) {
|
setValue(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
|
@ -56,14 +64,15 @@ class Blockchain extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
return (<React.Fragment>
|
return (<React.Fragment>
|
||||||
<h3> 1. Set the value in the blockchain</h3>
|
<h3> 1. Set the value in the blockchain</h3>
|
||||||
<Form inline>
|
<Form inline onKeyDown={(e) => this.checkEnter(e, this.setValue)}>
|
||||||
<FormGroup>
|
<FormGroup>
|
||||||
<FormControl
|
<FormControl
|
||||||
type="text"
|
type="text"
|
||||||
defaultValue={this.state.valueSet}
|
defaultValue={this.state.valueSet}
|
||||||
onChange={(e) => this.handleChange(e)}/>
|
onChange={(e) => this.handleChange(e)}/>
|
||||||
<Button bsStyle="primary" onClick={(e) => this.setValue(e)}>Set Value</Button>
|
<Button bsStyle="primary" onClick={(e) => this.setValue(e)}>Set Value</Button>
|
||||||
<HelpBlock>Once you set the value, the transaction will need to be mined and then the value will be updated on the blockchain.</HelpBlock>
|
<HelpBlock>Once you set the value, the transaction will need to be mined and then the value will be updated
|
||||||
|
on the blockchain.</HelpBlock>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
</Form>
|
</Form>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue