Openstatus www.openstatus.dev
at main 25 lines 562 B view raw
1import { cn } from "@/lib/utils"; 2import NextLink from "next/link"; 3 4// TODO: we could add cva variants for the link 5 6export function Link({ 7 children, 8 className, 9 ...props 10}: React.ComponentProps<typeof NextLink>) { 11 const isExternal = props.href?.toString().startsWith("http"); 12 const externalProps = isExternal 13 ? { target: "_blank", rel: "noopener noreferrer" } 14 : {}; 15 16 return ( 17 <NextLink 18 className={cn("font-medium text-foreground", className)} 19 {...externalProps} 20 {...props} 21 > 22 {children} 23 </NextLink> 24 ); 25}