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

36 lines
893 B
TypeScript
Raw Normal View History

2019-03-21 12:10:32 +00:00
import * as React from "react";
import BaseWidget, { IWidgetProps, IWidgetState } from "./BaseWidget";
import { WidgetType, CSSUnits } from "../constants/WidgetConstants";
import TextComponent from "../editorComponents/TextComponent";
import _ from "lodash";
class TextWidget extends BaseWidget<ITextWidgetProps, IWidgetState> {
constructor(widgetProps: ITextWidgetProps) {
2019-03-21 12:10:32 +00:00
super(widgetProps);
}
getPageView() {
return (
<TextComponent
2019-03-19 14:05:48 +00:00
style={this.getPositionStyle()}
widgetId={this.props.widgetId}
key={this.props.widgetId}
text={this.props.text}
2019-03-21 12:10:32 +00:00
tagName={this.props.tagName}
/>
2019-03-21 12:10:32 +00:00
);
}
getWidgetType(): WidgetType {
2019-03-21 12:10:32 +00:00
return "TEXT_WIDGET";
}
}
export interface ITextWidgetProps extends IWidgetProps {
2019-03-21 12:10:32 +00:00
text?: string;
ellipsize?: boolean;
tagName?: keyof JSX.IntrinsicElements;
}
2019-03-21 12:10:32 +00:00
export default TextWidget;