forked from react-toolbox/react-toolbox
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathswitch.js
More file actions
41 lines (37 loc) · 1.01 KB
/
switch.js
File metadata and controls
41 lines (37 loc) · 1.01 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
import React from 'react';
import Switch from '../../components/switch';
class SwitchTest extends React.Component {
state = {
switch_1: true,
switch_2: false,
switch_3: true
};
handleChange = (field, value) => {
this.setState({...this.state, [field]: value});
};
render () {
return (
<section>
<h5>Switches</h5>
<p style={{marginBottom: '10px'}}>This is more beautiful than the old fashion checkboxes...</p>
<Switch
checked={this.state.switch_1}
label="Push notifications"
onChange={this.handleChange.bind(this, 'switch_1')}
/>
<Switch
checked={this.state.switch_2}
label="Mail notifications"
onChange={this.handleChange.bind(this, 'switch_2')}
/>
<Switch
checked={this.state.switch_3}
disabled
label="Nothing, thanks"
onChange={this.handleChange.bind(this, 'switch_3')}
/>
</section>
);
}
}
export default SwitchTest;