2015-10-11 20:07:09 +03:00
|
|
|
import React from 'react';
|
2015-09-21 11:01:52 +03:00
|
|
|
import Switch from '../../components/switch';
|
|
|
|
|
2015-10-22 02:31:17 +03:00
|
|
|
class SwitchTest extends React.Component {
|
2015-11-12 07:52:05 +03:00
|
|
|
state = {
|
|
|
|
switch: [true, false, false]
|
|
|
|
};
|
|
|
|
|
2015-11-25 13:31:59 +03:00
|
|
|
handleChange = (index, value) => {
|
2015-11-12 07:52:05 +03:00
|
|
|
const state = this.state.switch;
|
2015-11-25 13:31:59 +03:00
|
|
|
state[index] = value;
|
2015-11-12 07:52:05 +03:00
|
|
|
this.setState({switch: state});
|
2015-10-22 02:31:17 +03:00
|
|
|
};
|
2015-09-21 11:01:52 +03:00
|
|
|
|
|
|
|
render () {
|
|
|
|
return (
|
|
|
|
<section>
|
2015-10-07 23:24:02 +03:00
|
|
|
<h5>Switches</h5>
|
|
|
|
<p style={{marginBottom: '10px'}}>This is more beautiful than the old fashion checkboxes...</p>
|
2015-11-12 07:52:05 +03:00
|
|
|
<Switch
|
|
|
|
checked={this.state.switch[0]}
|
|
|
|
label="Push notifications"
|
|
|
|
onChange={this.handleChange.bind(this, 0)}
|
|
|
|
/>
|
|
|
|
<Switch
|
|
|
|
checked={this.state.switch[1]}
|
|
|
|
label="Mail notifications"
|
|
|
|
onChange={this.handleChange.bind(this, 1)}
|
|
|
|
/>
|
|
|
|
<Switch
|
|
|
|
checked={this.state.switch[2]}
|
|
|
|
disabled
|
|
|
|
label="Nothing, thanks"
|
|
|
|
onChange={this.handleChange.bind(this, 2)}
|
|
|
|
/>
|
2015-09-21 11:01:52 +03:00
|
|
|
</section>
|
|
|
|
);
|
|
|
|
}
|
2015-10-21 13:25:07 +03:00
|
|
|
}
|
2015-10-22 02:31:17 +03:00
|
|
|
|
|
|
|
export default SwitchTest;
|