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

32 lines
808 B
TypeScript
Raw Normal View History

2019-08-29 11:22:09 +00:00
import React from "react";
2019-09-09 09:08:54 +00:00
import BaseWidget, { WidgetProps, WidgetState } from "./BaseWidget";
2019-08-29 11:22:09 +00:00
import { WidgetType } from "../constants/WidgetConstants";
2019-10-31 05:28:11 +00:00
import TextComponent from "../components/blueprint/TextComponent";
2019-09-09 09:08:54 +00:00
class TextWidget extends BaseWidget<TextWidgetProps, WidgetState> {
getPageView() {
return (
2019-10-31 05:28:11 +00:00
<TextComponent
2019-03-19 14:05:48 +00:00
style={this.getPositionStyle()}
widgetId={this.props.widgetId}
key={this.props.widgetId}
2019-10-31 05:28:11 +00:00
textStyle={this.props.textStyle}
text={this.props.text}
/>
2019-03-21 12:10:32 +00:00
);
}
getWidgetType(): WidgetType {
2019-03-21 12:10:32 +00:00
return "TEXT_WIDGET";
}
}
export type TextStyle = "BODY" | "HEADING" | "LABEL" | "SUB_TEXT";
2019-09-12 08:11:25 +00:00
2019-09-09 09:08:54 +00:00
export interface TextWidgetProps extends WidgetProps {
2019-03-21 12:10:32 +00:00
text?: string;
2019-10-31 05:28:11 +00:00
textStyle: TextStyle;
}
2019-03-21 12:10:32 +00:00
export default TextWidget;