linkButtonComponent.tsx 916 B

123456789101112131415161718192021222324252627282930313233
  1. import * as React from "react";
  2. interface ILinkButtonComponentProps {
  3. label: string;
  4. buttonLabel: string;
  5. url?: string;
  6. onClick: () => void;
  7. }
  8. export class LinkButtonComponent extends React.Component<ILinkButtonComponentProps> {
  9. constructor(props: ILinkButtonComponentProps) {
  10. super(props);
  11. }
  12. onLink() {
  13. if (this.props.url) {
  14. window.open(this.props.url, '_blank');
  15. }
  16. }
  17. render() {
  18. return (
  19. <div className={"linkButtonLine"}>
  20. <div className="link" title={this.props.label} onClick={() => this.onLink()}>
  21. {this.props.label}
  22. </div>
  23. <div className="link-button">
  24. <button onClick={() => this.props.onClick()}>{this.props.buttonLabel}</button>
  25. </div>
  26. </div>
  27. );
  28. }
  29. }