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-03-21 12:10:32 +00:00
|
|
|
import TextComponent from "../editorComponents/TextComponent";
|
2019-02-10 14:14:58 +00:00
|
|
|
|
2019-09-09 09:08:54 +00:00
|
|
|
class TextWidget extends BaseWidget<TextWidgetProps, WidgetState> {
|
2019-03-18 15:10:30 +00:00
|
|
|
getPageView() {
|
2019-02-10 14:14:58 +00:00
|
|
|
return (
|
|
|
|
|
<TextComponent
|
2019-03-19 14:05:48 +00:00
|
|
|
style={this.getPositionStyle()}
|
2019-02-11 18:22:23 +00:00
|
|
|
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-02-10 14:14:58 +00:00
|
|
|
/>
|
2019-03-21 12:10:32 +00:00
|
|
|
);
|
2019-02-10 14:14:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getWidgetType(): WidgetType {
|
2019-03-21 12:10:32 +00:00
|
|
|
return "TEXT_WIDGET";
|
2019-02-10 14:14:58 +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;
|
|
|
|
|
ellipsize?: boolean;
|
|
|
|
|
tagName?: keyof JSX.IntrinsicElements;
|
2019-02-10 14:14:58 +00:00
|
|
|
}
|
|
|
|
|
|
2019-03-21 12:10:32 +00:00
|
|
|
export default TextWidget;
|