Browse Source

enable data-toggle for anchor link id attr

jam411 3 years ago
parent
commit
681b128566
1 changed files with 3 additions and 2 deletions
  1. 3 2
      packages/app/src/components/ReactMarkdownComponents/NextLink.tsx

+ 3 - 2
packages/app/src/components/ReactMarkdownComponents/NextLink.tsx

@@ -26,10 +26,11 @@ type Props = Omit<LinkProps, 'href'> & {
   children: React.ReactNode,
   href?: string,
   className?: string,
+  'data-toggle'?: string
 };
 
 export const NextLink = ({
-  href, children, className, ...props
+  href, children, className, 'data-toggle': dataToggle, ...props
 }: Props): JSX.Element => {
 
   const { data: siteUrl } = useSiteUrl();
@@ -41,7 +42,7 @@ export const NextLink = ({
   // when href is an anchor link
   if (isAnchorLink(href)) {
     return (
-      <a href={href} className={className}>{children}</a>
+      <a href={href} className={className} data-toggle={dataToggle}>{children}</a>
     );
   }