-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy patha.js
56 lines (47 loc) · 959 Bytes
/
a.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
'use strict';
var React = require('react');
var ReactCSS = require('reactcss');
class Button extends ReactCSS.Component {
classes() {
return {
'default': {
button: {
background: '#4A90E2'
}
},
'disabled-true': {
button: {
background: '#bbb'
},
span: {
color: '#999'
}
}
}
}
render() {
return (
<div is="button" onClick={this.props.onClick}>
<span is="span">
{ this.props.label }
</span>
</div>
)
}
}
var App = React.createClass({
getInitialState: function () {
return { disabled: false };
},
toggleHandler() {
this.setState({
disabled: !this.state.disabled
})
},
render() {
return (
<Button label="click to toggle" disabled={this.state.disabled} onClick={this.toggleHandler} />
);
}
});
React.render(<App />, document.getElementById('app'));