2017-09-25 02:06:28 +00:00
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
interface AAttributes {
|
|
|
|
charset?: string;
|
2017-11-07 06:24:54 +00:00
|
|
|
className?: string;
|
2017-09-25 02:06:28 +00:00
|
|
|
coords?: string;
|
|
|
|
download?: string;
|
|
|
|
href: string;
|
|
|
|
hreflang?: string;
|
|
|
|
media?: string;
|
|
|
|
name?: string;
|
|
|
|
rel?:
|
|
|
|
| 'alternate'
|
|
|
|
| 'author'
|
|
|
|
| 'bookmark'
|
|
|
|
| 'external'
|
|
|
|
| 'help'
|
|
|
|
| 'license'
|
|
|
|
| 'next'
|
|
|
|
| 'nofollow'
|
|
|
|
| 'noreferrer'
|
|
|
|
| 'noopener'
|
|
|
|
| 'prev'
|
|
|
|
| 'search'
|
|
|
|
| 'tag';
|
|
|
|
rev?: string;
|
|
|
|
shape?: 'default' | 'rect' | 'circle' | 'poly';
|
|
|
|
target?: '_blank' | '_parent' | '_self' | '_top';
|
|
|
|
type?: string;
|
2018-01-01 19:46:28 +00:00
|
|
|
onClick?(ev: React.MouseEvent<HTMLAnchorElement>): void;
|
2017-09-25 02:06:28 +00:00
|
|
|
}
|
|
|
|
|
2017-11-07 18:42:53 +00:00
|
|
|
interface NewTabLinkProps extends AAttributes {
|
2017-09-25 02:06:28 +00:00
|
|
|
content?: React.ReactElement<any> | string;
|
|
|
|
children?: React.ReactElement<any> | string;
|
|
|
|
}
|
|
|
|
|
2017-11-07 18:42:53 +00:00
|
|
|
const NewTabLink = ({ content, children, ...rest }: NewTabLinkProps) => (
|
2018-01-10 05:17:52 +00:00
|
|
|
<a target="_blank" rel="noopener noreferrer" {...rest}>
|
2017-12-28 19:54:07 +00:00
|
|
|
{content || children}
|
2017-11-07 18:42:53 +00:00
|
|
|
</a>
|
|
|
|
);
|
2017-09-25 02:06:28 +00:00
|
|
|
|
|
|
|
export default NewTabLink;
|