@@ -20,6 +20,7 @@ export const style = cva("transition-colors gap-2", {
20
20
}
21
21
} ,
22
22
defaultVariants : {
23
+ color : "primary" ,
23
24
underline : false
24
25
}
25
26
} ) ;
@@ -28,13 +29,14 @@ export type VariantProps = GetVariantProps<typeof style>;
28
29
29
30
type LinkProps = {
30
31
underline ?: boolean ;
32
+ nofollow ?: boolean ;
31
33
external ?: boolean ;
32
- } & RequiredKeys < VariantProps , "color" >
34
+ } & VariantProps
33
35
& Omit < React . AnchorHTMLAttributes < HTMLAnchorElement > , keyof InternalLinkProps >
34
36
& InternalLinkProps
35
37
& React . RefAttributes < HTMLAnchorElement > ;
36
38
37
- const Link = ( { className, color, underline, children, external, hrefLang = "en" , rel, ...props } : LinkProps ) => {
39
+ const Link = ( { className, color, underline, children, external, nofollow , hrefLang = "en" , rel, ...props } : LinkProps ) => {
38
40
39
41
const computedClassName = useMemo (
40
42
( ) => twMerge ( style ( { color, underline } ) , className ) ,
@@ -45,13 +47,13 @@ const Link = ({ className, color, underline, children, external, hrefLang = "en"
45
47
< InternalLink
46
48
className = { computedClassName }
47
49
hrefLang = { hrefLang }
48
- rel = { `${ external ? "external" : "" } ${ rel ?? "" } ` }
50
+ rel = { `${ external ? "external opener " : "" } ${ nofollow ? "nofollow" : "" } ${ rel ?? "" } ` . trim ( ) }
49
51
target = { external ? "_blank" : undefined }
50
52
{ ...props }
51
53
>
52
54
{ children }
53
55
{ external && < ArrowTopRightOnSquareIcon
54
- className = "inline w-4 h-4 "
56
+ className = "inline-block w-[1em] h-[1em] "
55
57
/> }
56
58
</ InternalLink >
57
59
) ;
0 commit comments