forked from yuristrelets/react-toolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheckbox.js
More file actions
56 lines (49 loc) · 1.32 KB
/
checkbox.js
File metadata and controls
56 lines (49 loc) · 1.32 KB
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
import React from 'react';
import Checkbox from '../../components/checkbox';
class CheckboxTest extends React.Component {
state = {
checkbox_1: true,
checkbox_2: false,
checkbox_3: true
};
handleChange = (field, value) => {
this.setState({...this.state, [field]: value});
};
handleFocus = () => {
console.log('Focused');
};
handleBlur = () => {
console.log('Blur');
};
render () {
return (
<section>
<h5>Checkbox</h5>
<p style={{marginBottom: '10px'}}>Lorem ipsum...</p>
<Checkbox
checked={this.state.checkbox_1}
label="Checked checkbox"
onChange={this.handleChange.bind(this, 'checkbox_1')}
onFocus={this.handleFocus}
onBlur={this.handleBlur}
/>
<Checkbox
checked={this.state.checkbox_2}
label="Not checked checkbox"
onChange={this.handleChange.bind(this, 'checkbox_2')}
onFocus={this.handleFocus}
onBlur={this.handleBlur}
/>
<Checkbox
checked={this.state.checkbox_3}
label="Disabled checkbox"
disabled
onChange={this.handleChange.bind(this, 'checkbox_3')}
onFocus={this.handleFocus}
onBlur={this.handleBlur}
/>
</section>
);
}
}
export default CheckboxTest;