Property Pane Controls
- Fixes #121, #122, #123, #124, #90, #46, #65, #100, #101, #68, #102
2019-10-24 05:24:45 +00:00
|
|
|
import React from "react";
|
|
|
|
|
import BaseControl, { ControlProps } from "./BaseControl";
|
2020-02-26 12:44:56 +00:00
|
|
|
import { StyledSwitch } from "./StyledControls";
|
Property Pane Controls
- Fixes #121, #122, #123, #124, #90, #46, #65, #100, #101, #68, #102
2019-10-24 05:24:45 +00:00
|
|
|
|
|
|
|
|
class SwitchControl extends BaseControl<ControlProps> {
|
|
|
|
|
render() {
|
|
|
|
|
return (
|
2020-02-26 12:44:56 +00:00
|
|
|
<StyledSwitch
|
|
|
|
|
onChange={this.onToggle}
|
|
|
|
|
defaultChecked={this.props.propertyValue}
|
|
|
|
|
large
|
|
|
|
|
/>
|
Property Pane Controls
- Fixes #121, #122, #123, #124, #90, #46, #65, #100, #101, #68, #102
2019-10-24 05:24:45 +00:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onToggle = () => {
|
|
|
|
|
this.updateProperty(this.props.propertyName, !this.props.propertyValue);
|
|
|
|
|
};
|
|
|
|
|
|
2020-04-14 05:35:16 +00:00
|
|
|
static getControlType() {
|
Property Pane Controls
- Fixes #121, #122, #123, #124, #90, #46, #65, #100, #101, #68, #102
2019-10-24 05:24:45 +00:00
|
|
|
return "SWITCH";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type SwitchControlProps = ControlProps;
|
|
|
|
|
|
|
|
|
|
export default SwitchControl;
|