PromucFlow_constructor/app/client/src/widgets/TextWidget.tsx
Nikhil Nandgopal 85b8525c4d added type to state
moved css to style object
added style units
migrated all widgets to work with JSX
2019-02-11 23:52:23 +05:30

40 lines
1.0 KiB
TypeScript

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) {
super(widgetProps)
}
getWidgetView() {
return (
<TextComponent
style={{
positionType: "ABSOLUTE",
yPosition: this.props.topRow * this.props.parentRowSpace,
xPosition: this.props.leftColumn * this.props.parentColumnSpace,
xPositionUnit: CSSUnits.PIXEL,
yPositionUnit: CSSUnits.PIXEL
}}
widgetId={this.props.widgetId}
key={this.props.widgetId}
text={this.props.text}
/>
)
}
getWidgetType(): WidgetType {
return "TEXT_WIDGET"
}
}
export interface ITextWidgetProps extends IWidgetProps {
text?: string
ellipsize?: boolean
}
export default TextWidget