mirror of
https://git.um-react.app/um/um-react.git
synced 2025-11-28 03:23:02 +00:00
refactor: batch 1
This commit is contained in:
@@ -1,12 +1,15 @@
|
||||
import type { AnchorHTMLAttributes } from 'react';
|
||||
import { ExternalLinkIcon } from '@chakra-ui/icons';
|
||||
import { Link } from '@chakra-ui/react';
|
||||
import { FiExternalLink } from 'react-icons/fi';
|
||||
|
||||
export function ExtLink({ children, ...props }: AnchorHTMLAttributes<HTMLAnchorElement>) {
|
||||
export type ExtLinkProps = AnchorHTMLAttributes<HTMLAnchorElement> & {
|
||||
icon?: boolean;
|
||||
};
|
||||
|
||||
export function ExtLink({ className, icon = true, children, ...props }: ExtLinkProps) {
|
||||
return (
|
||||
<Link isExternal {...props} rel="noreferrer noopener nofollow">
|
||||
<a rel="noreferrer noopener nofollow" className={`link ${className}`} {...props}>
|
||||
{children}
|
||||
<ExternalLinkIcon />
|
||||
</Link>
|
||||
{icon && <FiExternalLink />}
|
||||
</a>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user