import { autoBindMethodsForReact } from 'class-autobind-decorator'; import classnames from 'classnames'; import React, { PureComponent, ReactNode } from 'react'; import { AUTOBIND_CFG } from '../../../common/constants'; import { clickLink } from '../../../common/electron-helpers'; interface Props { href: string; title?: string; button?: boolean; onClick?: (...args: any[]) => any; className?: string; children?: ReactNode; disabled?: boolean; noTheme?: boolean; } @autoBindMethodsForReact(AUTOBIND_CFG) export class Link extends PureComponent { _handleClick(e: React.MouseEvent) { e?.preventDefault(); const { href, onClick } = this.props; // Also call onClick that was passed to us if there was one onClick?.(e); clickLink(href); } render() { const { onClick, // eslint-disable-line @typescript-eslint/no-unused-vars button, href, children, className, disabled, noTheme, ...other } = this.props; return button ? ( ) : ( {children} ); } }