mirror of
https://github.com/tuono-labs/tuono
synced 2026-07-29 05:42:47 -07:00
37 lines
849 B
TypeScript
37 lines
849 B
TypeScript
import type { JSX, AnchorHTMLAttributes } from 'react'
|
|
import { Button } from '@mantine/core'
|
|
import { Link } from 'tuono'
|
|
import { IconExternalLink } from '@tabler/icons-react'
|
|
|
|
export default function MdxLink(
|
|
props: AnchorHTMLAttributes<HTMLAnchorElement>,
|
|
): JSX.Element {
|
|
if (props.href?.startsWith('http') || props.href?.startsWith('mailto')) {
|
|
return (
|
|
<Button
|
|
component="a"
|
|
{...props}
|
|
target="_blank"
|
|
rightSection={
|
|
<IconExternalLink size="16px" style={{ marginLeft: -5 }} />
|
|
}
|
|
variant="transparent"
|
|
style={{ height: '20px' }}
|
|
mt={-2}
|
|
p={0}
|
|
/>
|
|
)
|
|
}
|
|
return (
|
|
<Button
|
|
component={Link}
|
|
{...props}
|
|
target="_blank"
|
|
variant="transparent"
|
|
style={{ height: '20px' }}
|
|
mt={-2}
|
|
p={0}
|
|
/>
|
|
)
|
|
}
|