mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
* added rel="noopener noreferrer" to link elements using external and noIcon prop * fix: resolve asChild and external prop conflicts in Link components * Revert "fix: resolve asChild and external prop conflicts in Link components" This reverts commit e99580049946b487ce4dc77e7cdab2cd17e5c820. * fix: remove asChild prop conflicts with external links
37 lines
829 B
TypeScript
37 lines
829 B
TypeScript
import { chakra } from '@chakra-ui/react';
|
|
import React from 'react';
|
|
|
|
import { IconButton } from 'toolkit/chakra/icon-button';
|
|
import { Link } from 'toolkit/chakra/link';
|
|
import { Tooltip } from 'toolkit/chakra/tooltip';
|
|
|
|
import IconSvg from '../IconSvg';
|
|
|
|
interface Props {
|
|
className?: string;
|
|
label?: string;
|
|
href: string;
|
|
}
|
|
|
|
const LinkNewTab = ({ className, label, href }: Props) => {
|
|
|
|
return (
|
|
<Tooltip content={ label }>
|
|
<IconButton
|
|
asChild
|
|
aria-label={ label ?? 'Open link' }
|
|
variant="icon_secondary"
|
|
boxSize={ 5 }
|
|
className={ className }
|
|
borderRadius={ 0 }
|
|
>
|
|
<Link href={ href } external noIcon>
|
|
<IconSvg name="open-link"/>
|
|
</Link>
|
|
</IconButton>
|
|
</Tooltip>
|
|
);
|
|
};
|
|
|
|
export default React.memo(chakra(LinkNewTab));
|