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 { UserLink } from './user-page'
|
||||||
import { Linkify } from './linkify'
|
import { Linkify } from './linkify'
|
||||||
import { Col } from './layout/col'
|
import { Col } from './layout/col'
|
||||||
import { SiteLink } from './link'
|
import { SiteLink } from './site-link'
|
||||||
|
|
||||||
export function ContractDetails(props: { contract: Contract }) {
|
export function ContractDetails(props: { contract: Contract }) {
|
||||||
const { contract } = props
|
const { contract } = props
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import Link from 'next/link'
|
|
||||||
import { Fragment } from 'react'
|
import { Fragment } from 'react'
|
||||||
|
import { SiteLink } from './site-link'
|
||||||
|
|
||||||
// Return a JSX span, linkifying @username, #hashtags, and https://...
|
// Return a JSX span, linkifying @username, #hashtags, and https://...
|
||||||
export function Linkify(props: { text: string }) {
|
export function Linkify(props: { text: string }) {
|
||||||
|
@ -20,12 +20,10 @@ export function Linkify(props: { text: string }) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{whitespace}
|
{whitespace}
|
||||||
<Link href={href}>
|
<SiteLink className="text-indigo-700" href={href}>
|
||||||
<a className="text-indigo-700 hover:underline hover:decoration-2">
|
{symbol}
|
||||||
{symbol}
|
{tag}
|
||||||
{tag}
|
</SiteLink>
|
||||||
</a>
|
|
||||||
</Link>
|
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
|
@ -8,7 +8,18 @@ export const SiteLink = (props: {
|
||||||
}) => {
|
}) => {
|
||||||
const { href, children, className } = 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}>
|
<Link href={href}>
|
||||||
<a
|
<a
|
||||||
className={clsx(
|
className={clsx(
|
|
@ -5,7 +5,7 @@ import { Row } from './layout/row'
|
||||||
import { formatMoney } from '../lib/util/format'
|
import { formatMoney } from '../lib/util/format'
|
||||||
import { SEO } from './SEO'
|
import { SEO } from './SEO'
|
||||||
import { Page } from './page'
|
import { Page } from './page'
|
||||||
import { SiteLink } from './link'
|
import { SiteLink } from './site-link'
|
||||||
|
|
||||||
export function UserLink(props: { username: string; className?: string }) {
|
export function UserLink(props: { username: string; className?: string }) {
|
||||||
const { username, className } = props
|
const { username, className } = props
|
||||||
|
|
Loading…
Reference in New Issue
Block a user