Skip to content

Commit

Permalink
conditional render of link
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Croft authored and Joshua Croft committed Dec 5, 2024
1 parent 57b69c0 commit 8a80e90
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion theme/fetch-ai-docs/mdx-components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import React from "react";
import Image from "next/image";
import LinkImage from "../../src/svgs/external-link.svg";
import { ModifiedPre } from "components/code";

// Anchor links
function HeadingLink({
tag: Tag,
Expand Down Expand Up @@ -162,7 +163,23 @@ export const Link = ({ href = "", className, ...props }: AnchorProps) => {
typeof child === "string" ? child.split("↗️")[0] : child,
);

return (
return "↗" == splitChildren[0] ? (
<>
<span className="nx-inline-flex nx-gap-1">
<Anchor
href={href}
newWindow={EXTERNAL_HREF_REGEX.test(href)}
className={cn(
"nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]",
className,
)}
{...props}
>
{splitChildren}
</Anchor>
</span>
</>
) : (
<>
<span className="nx-inline-flex nx-gap-1">
<Anchor
Expand Down

0 comments on commit 8a80e90

Please sign in to comment.