Просмотр исходного кода

enable data-toggle for anchor link id attr

jam411 3 лет назад
Родитель
Сommit
681b128566
1 измененных файлов с 3 добавлено и 2 удалено
  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,
   children: React.ReactNode,
   href?: string,
   href?: string,
   className?: string,
   className?: string,
+  'data-toggle'?: string
 };
 };
 
 
 export const NextLink = ({
 export const NextLink = ({
-  href, children, className, ...props
+  href, children, className, 'data-toggle': dataToggle, ...props
 }: Props): JSX.Element => {
 }: Props): JSX.Element => {
 
 
   const { data: siteUrl } = useSiteUrl();
   const { data: siteUrl } = useSiteUrl();
@@ -41,7 +42,7 @@ export const NextLink = ({
   // when href is an anchor link
   // when href is an anchor link
   if (isAnchorLink(href)) {
   if (isAnchorLink(href)) {
     return (
     return (
-      <a href={href} className={className}>{children}</a>
+      <a href={href} className={className} data-toggle={dataToggle}>{children}</a>
     );
     );
   }
   }