mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-05-10 16:15:23 -04:00
30 lines
553 B
TypeScript
30 lines
553 B
TypeScript
import Link from 'next/link'
|
|
|
|
export const CustomLink = ({
|
|
href,
|
|
children,
|
|
className,
|
|
}: {
|
|
href?: string
|
|
children: React.ReactNode
|
|
className?: string
|
|
}) => {
|
|
if (!href) return <>{children}</>
|
|
|
|
// If href is internal, use Next.js Link
|
|
if (href.startsWith('/')) {
|
|
return (
|
|
<Link href={href} className={className}>
|
|
{children}
|
|
</Link>
|
|
)
|
|
}
|
|
|
|
// For external links, fall back to <a>
|
|
return (
|
|
<a href={href} target="_blank" rel="noopener noreferrer" className={className}>
|
|
{children}
|
|
</a>
|
|
)
|
|
}
|