mirror of
https://github.com/yume-chan/ya-webadb.git
synced 2025-10-04 18:29:23 +02:00
25 lines
621 B
TypeScript
25 lines
621 B
TypeScript
import { Link } from '@fluentui/react';
|
|
import { ReactNode } from 'react';
|
|
import { withDisplayName } from '../utils/with-display-name';
|
|
|
|
export interface ExternalLinkProps {
|
|
href: string;
|
|
spaceBefore?: boolean;
|
|
spaceAfter?: boolean;
|
|
children?: ReactNode;
|
|
}
|
|
|
|
export const ExternalLink = withDisplayName('ExternalLink')(({
|
|
href,
|
|
spaceBefore,
|
|
spaceAfter,
|
|
children,
|
|
}: ExternalLinkProps) => {
|
|
return (
|
|
<>
|
|
{spaceBefore && ' '}
|
|
<Link href={href} target="_blank" rel="noopener">{children ?? href}</Link>
|
|
{spaceAfter && ' '}
|
|
</>
|
|
);
|
|
});
|