Skip to content

Commit

Permalink
fix internal links
Browse files Browse the repository at this point in the history
  • Loading branch information
saml33 committed Dec 20, 2023
1 parent ae3b88a commit 517df9a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
27 changes: 17 additions & 10 deletions app/components/RichText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,23 @@ const Ul = ({ children }) => (
<ul style={{ listStyle: 'inside disc', marginLeft: '16px' }}>{children}</ul>
)
const mangoUrl = 'https://mango.markets'
const A = ({ node, children }) => (
<Link
className="text-th-fgd-2 border-b border-th-active md:hover:border-transparent"
href={node.data.uri}
target={node.data.uri.startsWith(mangoUrl) ? '_self' : '_blank'}
rel={node.data.uri.startsWith(mangoUrl) ? '' : 'noopener noreferrer'}
>
{children}
</Link>
)
const A = ({ node, children }) => {
const { data } = node
const isInternal =
data.uri.includes(mangoUrl) ||
data.uri.includes('localhost') ||
!data.uri.includes('http')
return (
<Link
className="text-th-fgd-2 border-b border-th-active md:hover:border-transparent"
href={data.uri}
target={isInternal ? '_self' : '_blank'}
rel={isInternal ? '' : 'noopener noreferrer'}
>
{children}
</Link>
)
}

const Spacer = () => (
<hr style={{ borderColor: 'transparent', marginBottom: '12px' }} />
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.tsbuildinfo

Large diffs are not rendered by default.

1 comment on commit 517df9a

@vercel
Copy link

@vercel vercel bot commented on 517df9a Dec 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.