PromucFlow_constructor/app/client/src/widgets/TextWidget.tsx
2019-09-12 13:41:25 +05:30

34 lines
845 B
TypeScript

import React from "react";
import BaseWidget, { IWidgetProps, IWidgetState } from "./BaseWidget";
import { WidgetType } from "../constants/WidgetConstants";
import TextComponent from "../editorComponents/TextComponent";
class TextWidget extends BaseWidget<TextWidgetProps, IWidgetState> {
getPageView() {
return (
<TextComponent
style={this.getPositionStyle()}
widgetId={this.props.widgetId}
key={this.props.widgetId}
text={this.props.text}
tagName={this.props.tagName}
/>
);
}
getWidgetType(): WidgetType {
return "TEXT_WIDGET";
}
}
export type TextStyle = "BODY" | "HEADING" | "LABEL" | "SUB_TEXT"
export interface TextWidgetProps extends IWidgetProps {
text?: string;
textStyle?: TextStyle
tagName?: keyof JSX.IntrinsicElements;
}
export default TextWidget;