insomnia/app/components/base/Link.js
2016-07-07 13:10:55 -07:00

25 lines
478 B
JavaScript

import React, {Component, PropTypes} from 'react';
import {shell} from 'electron'
class Link extends Component {
_handleClick (e) {
e.preventDefault();
shell.openExternal(this.props.href);
}
render () {
const {href, children, ...other} = this.props;
return (
<a href={href} onClick={this._handleClick.bind(this)} {...other}>
{children}
</a>
)
}
}
Link.propTypes = {
href: PropTypes.string.isRequired
};
export default Link;