-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.jsx
38 lines (33 loc) · 1.03 KB
/
app.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
import React from 'react';
import ReactDOM from 'react-dom';
import {Gauge} from './src/index';
const DemoApp = React.createClass({
getInitialState: function () {
return {
gauge1: 35,
gauge2: 75
};
},
generateRandomValues: function () {
this.setState({
gauge1: Math.floor((Math.random() * 100) + 1),
gauge2: Math.floor((Math.random() * 100) + 1)
});
},
render: function () {
const inEdit = this.state.inEdit !== false;
return (
<div onClick={this.generateRandomValues}>
<div>
<Gauge type='full-gauge' value={this.state.gauge1} />
{this.state.gauge1}
</div>
<div>
<Gauge type='half-gauge' value={this.state.gauge2} color='LimeGreen' width='5em' />
{this.state.gauge2}
</div>
</div>
);
}
});
ReactDOM.render(<DemoApp />, document.getElementById('demo-app'));