-
Notifications
You must be signed in to change notification settings - Fork 19
/
ButtonSample.jsx
44 lines (39 loc) · 1.72 KB
/
ButtonSample.jsx
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
import React from "react";
import { Application,ShallowComponent } from "robe-react-commons";
import Button from "robe-react-ui/lib/buttons/Button";
import Toast from "robe-react-ui/lib/toast/Toast";
import {ControlLabel} from "react-bootstrap";
export default class ButtonSample extends ShallowComponent {
render():Object {
return (
<div>
<ControlLabel>{Application.i18n(ButtonSample,"buttons.ButtonSample","buttonNormal")}</ControlLabel>
<div className="form-group">
<Button bsStyle="primary" onClick={ButtonSample.onClick}>Normal</Button>
</div>
<ControlLabel>{Application.i18n(ButtonSample,"buttons.ButtonSample","buttonAsync")}</ControlLabel>
<div className="form-group">
<Button bsStyle="warning" onClickAsync={this.onClickAsync}>{Application.i18n(ButtonSample,"buttons.ButtonSample","async")}</Button>
</div>
<a href="https://react-bootstrap.github.io/components.html#buttons" rel="noopener noreferrer"
target="_blank">{Application.i18n(ButtonSample,"buttons.ButtonSample","forMoreLink")}</a>
</div>
);
}
static onClick(e: Object) {
Toast.info(`Button Click: ${e.target.innerText}`);
}
onClickAsync(e: Object, done: Function) {
let me = this;
// We used setTimeout to simulate an AJAX call.
setTimeout(function () {
me.onResponse(done);
}, 1000);
}
onResponse(done: Function) {
Toast.warning("Button Click: Async");
// done method is important
// Call this after all operations are done (at the end of AJAX)
done();
}
}