PromucFlow_constructor/app/client/src/editorComponents/TextComponent.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

28 lines
759 B
TypeScript

import * as React from "react"
import { IComponentProps } from "./BaseComponent"
import styled from "../constants/DefaultTheme"
const TextContainer = styled("span")<ITextComponentProps>`
color: ${props => props.theme.primaryColor};
position: ${props => props.style.positionType};
left: ${props => {
return props.style.xPosition + props.style.xPositionUnit
}};
top: ${props => {
return props.style.yPosition + props.style.yPositionUnit
}};
`
class TextComponent extends React.Component<ITextComponentProps> {
render() {
return <TextContainer {...this.props}>{this.props.text}</TextContainer>
}
}
export interface ITextComponentProps extends IComponentProps {
text?: string
ellipsize?: boolean
}
export default TextComponent