1- import DynamicLink from "components/DynamicLink" ;
21import React from "react" ;
32import styled from "styled-components" ;
43
4+ import DynamicLink from "components/DynamicLink" ;
5+
56type Props = {
67 to ?: string ;
78 onClick ?: ( ) => void ;
@@ -11,6 +12,7 @@ type Props = {
1112 color ?: string ;
1213 hoverColor ?: string ;
1314 showTargetBlankIcon ?: boolean ;
15+ inline ?: boolean ;
1416} ;
1517
1618const Link : React . FC < Props > = ( {
@@ -22,14 +24,39 @@ const Link: React.FC<Props> = ({
2224 color = "#ffffff" ,
2325 hoverColor,
2426 showTargetBlankIcon = true ,
27+ inline = true ,
2528} ) => {
2629 return (
2730 < LinkWrapper hoverColor = { hoverColor } color = { color } >
2831 { to ? (
29- < StyledLink to = { to } target = { target } color = { color } >
32+ < StyledLink
33+ to = { to }
34+ target = { target }
35+ color = { color }
36+ inline = { inline }
37+ >
3038 { children }
3139 { target === "_blank" && showTargetBlankIcon && (
32- < Svg color = { color } hoverColor = { hoverColor } data-testid = "geist-icon" fill = "none" height = "1em" shape-rendering = "geometricPrecision" stroke = "currentColor" stroke-linecap = "round" strokeLinejoin = "round" stroke-width = "2" viewBox = "0 0 24 24" width = "1em" data-darkreader-inline-stroke = "" data-darkreader-inline-color = "" > < path d = "M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6" > </ path > < path d = "M15 3h6v6" > </ path > < path d = "M10 14L21 3" > </ path > </ Svg >
40+ < Svg
41+ color = { color }
42+ hoverColor = { hoverColor }
43+ data-testid = "geist-icon"
44+ fill = "none"
45+ height = "1em"
46+ shape-rendering = "geometricPrecision"
47+ stroke = "currentColor"
48+ stroke-linecap = "round"
49+ strokeLinejoin = "round"
50+ stroke-width = "2"
51+ viewBox = "0 0 24 24"
52+ width = "1em"
53+ data-darkreader-inline-stroke = ""
54+ data-darkreader-inline-color = ""
55+ >
56+ < path d = "M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6" > </ path >
57+ < path d = "M15 3h6v6" > </ path >
58+ < path d = "M10 14L21 3" > </ path >
59+ </ Svg >
3360 ) }
3461 </ StyledLink >
3562 ) : (
@@ -44,7 +71,7 @@ const Link: React.FC<Props> = ({
4471
4572export default Link ;
4673
47- const Svg = styled . svg < { color : string , hoverColor ?: string } > `
74+ const Svg = styled . svg < { color : string ; hoverColor ?: string } > `
4875 margin-left: 5px;
4976 stroke: ${ ( props ) => props . color } ;
5077 stroke-width: 2;
@@ -59,9 +86,13 @@ const Underline = styled.div<{ color: string }>`
5986 background: ${ ( props ) => props . color } ;
6087` ;
6188
62- const StyledLink = styled ( DynamicLink ) < { hasunderline ?: boolean , color : string , removeInline ?: boolean } > `
89+ const StyledLink = styled ( DynamicLink ) < {
90+ hasunderline ?: boolean ;
91+ color : string ;
92+ inline : boolean ;
93+ } > `
6394 color: ${ ( props ) => props . color } ;
64- ${ ( props ) => ! props . removeInline && "display: inline-flex;" } ;
95+ ${ ( props ) => props . inline && "display: inline-flex;" } ;
6596 font-size: 13px;
6697 cursor: pointer;
6798 align-items: center;
@@ -75,7 +106,7 @@ const Div = styled.span<{ color: string }>`
75106 align-items: center;
76107` ;
77108
78- const LinkWrapper = styled . span < { hoverColor ?: string , color : string } > `
109+ const LinkWrapper = styled . span < { hoverColor ?: string ; color : string } > `
79110 position: relative;
80111 display: inline-flex;
81112 align-items: center;
@@ -95,5 +126,5 @@ const LinkWrapper = styled.span<{ hoverColor?: string, color: string }>`
95126 svg {
96127 stroke: ${ ( { hoverColor, color } ) => hoverColor ?? color } ;
97128 }
98- };
99- ` ;
129+ }
130+ ` ;
0 commit comments