Lightcord/BetterDiscordApp/src/ui/components/switch.jsx

22 lines
588 B
JavaScript

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
}
}