Don't wrap external link with next/link
This commit is contained in:
parent
6eda71286c
commit
f1977f26ea
|
@ -15,7 +15,7 @@ import { User } from '../lib/firebase/users'
|
|||
import { UserLink } from './user-page'
|
||||
import { Linkify } from './linkify'
|
||||
import { Col } from './layout/col'
|
||||
import { SiteLink } from './link'
|
||||
import { SiteLink } from './site-link'
|
||||
|
||||
export function ContractDetails(props: { contract: Contract }) {
|
||||
const { contract } = props
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import Link from 'next/link'
|
||||
import { Fragment } from 'react'
|
||||
import { SiteLink } from './site-link'
|
||||
|
||||
// Return a JSX span, linkifying @username, #hashtags, and https://...
|
||||
export function Linkify(props: { text: string }) {
|
||||
|
@ -20,12 +20,10 @@ export function Linkify(props: { text: string }) {
|
|||
return (
|
||||
<>
|
||||
{whitespace}
|
||||
<Link href={href}>
|
||||
<a className="text-indigo-700 hover:underline hover:decoration-2">
|
||||
<SiteLink className="text-indigo-700" href={href}>
|
||||
{symbol}
|
||||
{tag}
|
||||
</a>
|
||||
</Link>
|
||||
</SiteLink>
|
||||
</>
|
||||
)
|
||||
})
|
||||
|
|
|
@ -8,7 +8,18 @@ export const SiteLink = (props: {
|
|||
}) => {
|
||||
const { href, children, className } = props
|
||||
|
||||
return (
|
||||
return href.startsWith('http') ? (
|
||||
<a
|
||||
href={href}
|
||||
className={clsx(
|
||||
'hover:underline hover:decoration-indigo-400 hover:decoration-2',
|
||||
className
|
||||
)}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
{children}
|
||||
</a>
|
||||
) : (
|
||||
<Link href={href}>
|
||||
<a
|
||||
className={clsx(
|
|
@ -5,7 +5,7 @@ import { Row } from './layout/row'
|
|||
import { formatMoney } from '../lib/util/format'
|
||||
import { SEO } from './SEO'
|
||||
import { Page } from './page'
|
||||
import { SiteLink } from './link'
|
||||
import { SiteLink } from './site-link'
|
||||
|
||||
export function UserLink(props: { username: string; className?: string }) {
|
||||
const { username, className } = props
|
||||
|
|
Loading…
Reference in New Issue
Block a user