UNPKG

@ftrack/react-toolbox

Version:

A set of React components implementing Google's Material Design specification with the power of CSS Modules.

42 lines (37 loc) 1.03 kB
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;