123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- import * as React from "react";
- interface ITextLineComponentProps {
- label: string,
- value: string,
- color?: string,
- onLink?: () => void
- }
- export class TextLineComponent extends React.Component<ITextLineComponentProps> {
- constructor(props: ITextLineComponentProps) {
- super(props);
- }
- onLink() {
- if (!this.props.onLink) {
- return;
- }
- this.props.onLink();
- }
- renderContent() {
- if (this.props.onLink) {
- return (
- <div className="link-value" title={this.props.value} onClick={() => this.onLink()}>
- {this.props.value || "no name"}
- </div>
- )
- }
- return (
- <div className="value" title={this.props.value} style={{ color: this.props.color ? this.props.color : "" }}>
- {this.props.value || "no name"}
- </div>
- )
- }
- render() {
- return (
- <div className="textLine">
- <div className="label">
- {this.props.label}
- </div>
- {this.renderContent()}
- </div>
- );
- }
- }
|