PromucFlow_constructor/app/client/src/widgets/CheckboxWidget.tsx

32 lines
889 B
TypeScript
Raw Normal View History

2019-08-29 11:22:09 +00:00
import React from "react"
2019-03-21 12:10:32 +00:00
import BaseWidget, { IWidgetProps, IWidgetState } from "./BaseWidget"
2019-08-29 11:22:09 +00:00
import { WidgetType } from "../constants/WidgetConstants"
2019-03-21 12:10:32 +00:00
import CheckboxComponent from "../editorComponents/CheckboxComponent"
2019-09-12 12:19:46 +00:00
import { ActionPayload } from '../constants/ActionConstants';
2019-03-21 12:10:32 +00:00
2019-08-29 11:22:09 +00:00
class CheckboxWidget extends BaseWidget<CheckboxWidgetProps, IWidgetState> {
2019-03-21 12:10:32 +00:00
getPageView() {
return (
<CheckboxComponent
style={this.getPositionStyle()}
2019-09-12 08:11:25 +00:00
defaultCheckedState={this.props.defaultCheckedState}
label={this.props.label}
2019-03-21 12:10:32 +00:00
widgetId={this.props.widgetId}
key={this.props.widgetId}
/>
)
}
getWidgetType(): WidgetType {
2019-09-12 08:11:25 +00:00
return "CHECKBOX_WIDGET"
2019-03-21 12:10:32 +00:00
}
}
2019-08-29 11:22:09 +00:00
export interface CheckboxWidgetProps extends IWidgetProps {
2019-09-12 08:11:25 +00:00
label: string
defaultCheckedState: boolean
2019-09-12 12:19:46 +00:00
onCheckChange?: ActionPayload[]
2019-03-21 12:10:32 +00:00
}
export default CheckboxWidget