MCPcopy Create free account
hub / github.com/nextauthjs/next-auth-example / CustomLink

Function CustomLink

components/custom-link.tsx:9–41  ·  view source on GitHub ↗
({
  href,
  children,
  className,
  ...rest
}: CustomLinkProps)

Source from the content-addressed store, hash-verified

7}
8
9const CustomLink = ({
10 href,
11 children,
12 className,
13 ...rest
14}: CustomLinkProps) => {
15 const isInternalLink = href.startsWith("/")
16 const isAnchorLink = href.startsWith("#")
17
18 if (isInternalLink || isAnchorLink) {
19 return (
20 <Link href={href} className={className} {...rest}>
21 {children}
22 </Link>
23 )
24 }
25
26 return (
27 <Link
28 href={href}
29 target="_blank"
30 rel="noopener noreferrer"
31 className={cn(
32 "inline-flex items-center gap-1 align-baseline underline underline-offset-4",
33 className
34 )}
35 {...rest}
36 >
37 <span>{children}</span>
38 <ExternalLink className="ml-0.5 inline-block h-4 w-4" />
39 </Link>
40 )
41}
42
43export default CustomLink

Callers

nothing calls this directly

Calls 1

cnFunction · 0.90

Tested by

no test coverage detected