@@ -2,6 +2,7 @@ import React, { useMemo } from "react";
22import InternalLink , { LinkProps as InternalLinkProps } from "next/link" ;
33import { cva , VariantProps as GetVariantProps } from "class-variance-authority" ;
44import { twMerge } from "tailwind-merge" ;
5+ import ArrowTopRightOnSquareIcon from "@heroicons/react/24/solid/ArrowTopRightOnSquareIcon" ;
56
67import { RequiredKeys } from "@/types/utility" ;
78
@@ -26,20 +27,26 @@ export type VariantProps = GetVariantProps<typeof style>;
2627
2728type LinkProps = {
2829 underline ?: boolean ;
30+ external ?: boolean ;
2931} & RequiredKeys < VariantProps , "color" >
3032 & Omit < React . AnchorHTMLAttributes < HTMLAnchorElement > , keyof InternalLinkProps >
3133 & InternalLinkProps
3234 & React . RefAttributes < HTMLAnchorElement > ;
3335
34- const Link = ( { className, color, underline, ...props } : LinkProps ) => {
36+ const Link = ( { className, color, underline, children , external , hrefLang = "en" , ...props } : LinkProps ) => {
3537
3638 const computedClassName = useMemo (
3739 ( ) => twMerge ( style ( { color, underline } ) , className ) ,
3840 [ className , color , underline ]
3941 ) ;
4042
4143 return (
42- < InternalLink className = { computedClassName } { ...props } />
44+ < InternalLink className = { computedClassName } hrefLang = { hrefLang } { ...props } >
45+ { children }
46+ { external && < ArrowTopRightOnSquareIcon
47+ className = "inline w-4 h-4"
48+ /> }
49+ </ InternalLink >
4350 ) ;
4451} ;
4552
0 commit comments