|
|
@@ -28,13 +28,14 @@ const isAttached = (href: string): boolean => {
|
|
|
|
|
|
type Props = Omit<LinkProps, 'href'> & {
|
|
|
children: React.ReactNode,
|
|
|
+ id?: string,
|
|
|
href?: string,
|
|
|
className?: string,
|
|
|
};
|
|
|
|
|
|
export const NextLink = (props: Props): JSX.Element => {
|
|
|
const {
|
|
|
- href, children, className, ...rest
|
|
|
+ id, href, children, className, ...rest
|
|
|
} = props;
|
|
|
|
|
|
const { data: siteUrl } = useSiteUrl();
|
|
|
@@ -51,13 +52,13 @@ export const NextLink = (props: Props): JSX.Element => {
|
|
|
// when href is an anchor link
|
|
|
if (isAnchorLink(href)) {
|
|
|
return (
|
|
|
- <a href={href} className={className} {...dataAttributes}>{children}</a>
|
|
|
+ <a id={id} href={href} className={className} {...dataAttributes}>{children}</a>
|
|
|
);
|
|
|
}
|
|
|
|
|
|
if (isExternalLink(href, siteUrl)) {
|
|
|
return (
|
|
|
- <a href={href} className={className} target="_blank" rel="noopener noreferrer" {...dataAttributes}>
|
|
|
+ <a id={id} href={href} className={className} target="_blank" rel="noopener noreferrer" {...dataAttributes}>
|
|
|
{children} <i className='icon-share-alt small'></i>
|
|
|
</a>
|
|
|
);
|
|
|
@@ -68,7 +69,7 @@ export const NextLink = (props: Props): JSX.Element => {
|
|
|
const dlhref = href.replace('/attachment/', '/download/');
|
|
|
return (
|
|
|
<span>
|
|
|
- <a href={href} className={className} target="_blank" rel="noopener noreferrer" {...dataAttributes}>
|
|
|
+ <a id={id} href={href} className={className} target="_blank" rel="noopener noreferrer" {...dataAttributes}>
|
|
|
{children}
|
|
|
</a>
|
|
|
<a href={dlhref} className="attachment-download"><i className='icon-cloud-download'></i></a>
|