Summary: _typescript_ Reviewed By: priteshrnandgaonkar Differential Revision: D16828226 fbshipit-source-id: e6dd9946ae642a27ebc8a3f6dfce6773051f5a7a
35 lines
744 B
JavaScript
35 lines
744 B
JavaScript
/**
|
|
* Copyright 2018-present Facebook.
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
* @format
|
|
*/
|
|
|
|
import styled from '../styled/index.js';
|
|
import {colors} from './colors.tsx';
|
|
import {Component} from 'react';
|
|
import {shell} from 'electron';
|
|
|
|
const StyledLink = styled('span')({
|
|
color: colors.highlight,
|
|
'&:hover': {
|
|
cursor: 'pointer',
|
|
textDecoration: 'underline',
|
|
},
|
|
});
|
|
|
|
export default class Link extends Component<{
|
|
href: string,
|
|
children?: React$Node,
|
|
}> {
|
|
onClick = () => {
|
|
shell.openExternal(this.props.href);
|
|
};
|
|
|
|
render() {
|
|
return (
|
|
<StyledLink onClick={this.onClick}>{this.props.children}</StyledLink>
|
|
);
|
|
}
|
|
}
|