PromucFlow_constructor/app/client/src/components/propertyControls/ActionSelectorControl.tsx

32 lines
895 B
TypeScript
Raw Normal View History

2020-01-23 07:53:36 +00:00
import React from "react";
import BaseControl, { ControlProps } from "./BaseControl";
import { ControlWrapper } from "./StyledControls";
import { ControlType } from "constants/PropertyControlConstants";
2020-02-18 10:41:52 +00:00
import DynamicActionCreator from "components/editorComponents/DynamicActionCreator";
2020-01-23 07:53:36 +00:00
2020-02-18 10:41:52 +00:00
class ActionSelectorControl extends BaseControl<ControlProps> {
handleValueUpdate = (newValue: string) => {
const { propertyName } = this.props;
this.updateProperty(propertyName, newValue);
2020-01-23 07:53:36 +00:00
};
render() {
2020-02-18 10:41:52 +00:00
const { propertyValue } = this.props;
2020-01-23 07:53:36 +00:00
return (
2020-02-18 10:41:52 +00:00
<ControlWrapper>
<label>{this.props.label}</label>
<DynamicActionCreator
value={propertyValue}
onValueChange={this.handleValueUpdate}
/>
</ControlWrapper>
2020-01-23 07:53:36 +00:00
);
}
getControlType(): ControlType {
return "ACTION_SELECTOR";
}
}
2020-02-18 10:41:52 +00:00
export default ActionSelectorControl;