|
|
@@ -41,12 +41,11 @@ type Props = Omit<LinkProps, 'href'> & {
|
|
|
id?: string,
|
|
|
href?: string,
|
|
|
className?: string,
|
|
|
- onClickNextLink?: () => void,
|
|
|
};
|
|
|
|
|
|
export const NextLink = (props: Props): JSX.Element => {
|
|
|
const {
|
|
|
- id, href, children, className, onClickNextLink, ...rest
|
|
|
+ id, href, children, className, onClick, ...rest
|
|
|
} = props;
|
|
|
|
|
|
const { data: siteUrl } = useSiteUrl();
|
|
|
@@ -62,7 +61,7 @@ export const NextLink = (props: Props): JSX.Element => {
|
|
|
|
|
|
if (isExternalLink(href, siteUrl)) {
|
|
|
return (
|
|
|
- <a id={id} href={href} className={className} target="_blank" rel="noopener noreferrer" {...dataAttributes}>
|
|
|
+ <a id={id} href={href} className={className} target="_blank" onClick={onClick} rel="noopener noreferrer" {...dataAttributes}>
|
|
|
{children} <span className="growi-custom-icons">external_link</span>
|
|
|
</a>
|
|
|
);
|
|
|
@@ -71,13 +70,13 @@ export const NextLink = (props: Props): JSX.Element => {
|
|
|
// when href is an anchor link or not-creatable path
|
|
|
if (isAnchorLink(href) || !isCreatablePage(href)) {
|
|
|
return (
|
|
|
- <a id={id} href={href} className={className} {...dataAttributes}>{children}</a>
|
|
|
+ <a id={id} href={href} className={className} onClick={onClick} {...dataAttributes}>{children}</a>
|
|
|
);
|
|
|
}
|
|
|
|
|
|
return (
|
|
|
<Link {...rest} href={href} prefetch={false} legacyBehavior>
|
|
|
- <a href={href} className={className} {...dataAttributes} onClick={onClickNextLink}>{children}</a>
|
|
|
+ <a href={href} className={className} {...dataAttributes} onClick={onClick}>{children}</a>
|
|
|
</Link>
|
|
|
);
|
|
|
};
|