Make getFlipperLib generally available, and use it to decouple opening links from Electron
Summary: This stack reduces our direct dependency on Electron, for example by exposing our own API to open links. Also exposing `getFlipperLib` as API from `flipper-plugin`, so that these utility methods are available outside plugin contexts as well. Reviewed By: timur-valiev Differential Revision: D29661689 fbshipit-source-id: 0c0523326eeb0d9d8fbe3e03c4609327bb53596b
This commit is contained in:
committed by
Facebook GitHub Bot
parent
2b236c6114
commit
5dbd3bd414
@@ -8,8 +8,8 @@
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import {shell} from 'electron';
|
||||
import {styled, colors, FlexRow, Text, GK} from 'flipper';
|
||||
import {Typography} from 'antd';
|
||||
|
||||
const BannerContainer = styled(FlexRow)({
|
||||
height: '30px',
|
||||
@@ -34,14 +34,6 @@ const BannerLink = styled(CustomLink)({
|
||||
},
|
||||
});
|
||||
|
||||
const StyledLink = styled.span({
|
||||
'&:hover': {
|
||||
cursor: 'pointer',
|
||||
},
|
||||
});
|
||||
|
||||
StyledLink.displayName = 'CustomLink:StyledLink';
|
||||
|
||||
function CustomLink(props: {
|
||||
href: string;
|
||||
className?: string;
|
||||
@@ -49,12 +41,12 @@ function CustomLink(props: {
|
||||
style?: React.CSSProperties;
|
||||
}) {
|
||||
return (
|
||||
<StyledLink
|
||||
<Typography.Link
|
||||
className={props.className}
|
||||
onClick={() => shell.openExternal(props.href)}
|
||||
href={props.href}
|
||||
style={props.style}>
|
||||
{props.children || props.href}
|
||||
</StyledLink>
|
||||
</Typography.Link>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user