Summary: This removes the Non-Sandy UI from the Flipper codebase. It is a pretty rough scan for unused components, over time when converting more advanced components to Ant design probably even more code can be removed. Partially used `npx ts-purge` to reveal never imported source files. Changelog: It is no longer possible to opt out of the new Sandy UI Reviewed By: jknoxville Differential Revision: D25825282 fbshipit-source-id: 9041dbc7e03bce0760c9a0a34f1877851b5f06cf
39 lines
1022 B
TypeScript
39 lines
1022 B
TypeScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @format
|
|
*/
|
|
|
|
import {useCallback} from 'react';
|
|
import {shell} from 'electron';
|
|
import React from 'react';
|
|
import {Typography} from 'antd';
|
|
|
|
const AntOriginalLink = Typography.Link;
|
|
|
|
export default function Link(props: {
|
|
href: string;
|
|
children?: React.ReactNode;
|
|
style?: React.CSSProperties;
|
|
onClick?: ((event: React.MouseEvent<any>) => void) | undefined;
|
|
}) {
|
|
const onClick = useCallback(
|
|
(e: React.MouseEvent<any>) => {
|
|
shell.openExternal(props.href);
|
|
e.preventDefault();
|
|
e.stopPropagation();
|
|
},
|
|
[props.href],
|
|
);
|
|
|
|
return <AntOriginalLink {...props} onClick={props.onClick ?? onClick} />;
|
|
}
|
|
|
|
// XXX. For consistent usage, we monkey patch AntDesign's Link component,
|
|
// as we never want to open links internally, which gives a really bad experience
|
|
// @ts-ignore
|
|
Typography.Link = Link;
|