2020-09-05 22:50:45 +02:00
|
|
|
import BDV2 from "../../modules/v2";
|
|
|
|
|
|
|
|
const React = BDV2.React;
|
|
|
|
|
|
|
|
export default class Switch extends React.Component {
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
this.state = {checked: this.props.checked};
|
|
|
|
this.onChange = this.onChange.bind(this);
|
|
|
|
this.switch = <Lightcord.Api.Components.inputs.Switch onChange={this.onChange} value={this.state.checked} />
|
|
|
|
}
|
|
|
|
|
|
|
|
onChange(value) {
|
|
|
|
if (this.props.disabled) return;
|
|
|
|
this.props.onChange(value);
|
|
|
|
this.setState({checked: value});
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return this.switch
|
|
|
|
}
|
2020-05-16 23:24:51 +02:00
|
|
|
}
|