@@ -25,22 +25,25 @@ export class InfoBasePath extends React.Component {
2525
2626class Contact extends React . Component {
2727 static propTypes = {
28- data : PropTypes . object
28+ data : PropTypes . object ,
29+ getComponent : PropTypes . func . isRequired
2930 }
3031
3132 render ( ) {
32- let { data } = this . props
33+ let { data, getComponent } = this . props
3334 let name = data . get ( "name" ) || "the developer"
3435 let url = data . get ( "url" )
3536 let email = data . get ( "email" )
3637
38+ const Link = getComponent ( "Link" )
39+
3740 return (
3841 < div >
39- { url && < div > < a href = { sanitizeUrl ( url ) } target = "_blank" > { name } - Website</ a > </ div > }
42+ { url && < div > < Link href = { sanitizeUrl ( url ) } target = "_blank" > { name } - Website</ Link > </ div > }
4043 { email &&
41- < a href = { sanitizeUrl ( `mailto:${ email } ` ) } >
44+ < Link href = { sanitizeUrl ( `mailto:${ email } ` ) } >
4245 { url ? `Send email to ${ name } ` : `Contact ${ name } ` }
43- </ a >
46+ </ Link >
4447 }
4548 </ div >
4649 )
@@ -49,18 +52,23 @@ class Contact extends React.Component {
4952
5053class License extends React . Component {
5154 static propTypes = {
52- license : PropTypes . object
55+ license : PropTypes . object ,
56+ getComponent : PropTypes . func . isRequired
57+
5358 }
5459
5560 render ( ) {
56- let { license } = this . props
61+ let { license, getComponent } = this . props
62+
63+ const Link = getComponent ( "Link" )
64+
5765 let name = license . get ( "name" ) || "License"
5866 let url = license . get ( "url" )
5967
6068 return (
6169 < div >
6270 {
63- url ? < a target = "_blank" href = { sanitizeUrl ( url ) } > { name } </ a >
71+ url ? < Link target = "_blank" href = { sanitizeUrl ( url ) } > { name } </ Link >
6472 : < span > { name } </ span >
6573 }
6674 </ div >
@@ -70,12 +78,17 @@ class License extends React.Component {
7078
7179export class InfoUrl extends React . PureComponent {
7280 static propTypes = {
73- url : PropTypes . string . isRequired
81+ url : PropTypes . string . isRequired ,
82+ getComponent : PropTypes . func . isRequired
7483 }
7584
85+
7686 render ( ) {
77- const { url } = this . props
78- return < a target = "_blank" href = { sanitizeUrl ( url ) } > < span className = "url" > { url } </ span > </ a >
87+ const { url, getComponent } = this . props
88+
89+ const Link = getComponent ( "Link" )
90+
91+ return < Link target = "_blank" href = { sanitizeUrl ( url ) } > < span className = "url" > { url } </ span > </ Link >
7992 }
8093}
8194
@@ -100,6 +113,7 @@ export default class Info extends React.Component {
100113 const { url :externalDocsUrl , description :externalDocsDescription } = ( externalDocs || fromJS ( { } ) ) . toJS ( )
101114
102115 const Markdown = getComponent ( "Markdown" )
116+ const Link = getComponent ( "Link" )
103117 const VersionStamp = getComponent ( "VersionStamp" )
104118 const InfoUrl = getComponent ( "InfoUrl" )
105119 const InfoBasePath = getComponent ( "InfoBasePath" )
@@ -111,7 +125,7 @@ export default class Info extends React.Component {
111125 { version && < VersionStamp version = { version } > </ VersionStamp > }
112126 </ h2 >
113127 { host || basePath ? < InfoBasePath host = { host } basePath = { basePath } /> : null }
114- { url && < InfoUrl url = { url } /> }
128+ { url && < InfoUrl getComponent = { getComponent } url = { url } /> }
115129 </ hgroup >
116130
117131 < div className = "description" >
@@ -120,14 +134,14 @@ export default class Info extends React.Component {
120134
121135 {
122136 termsOfService && < div >
123- < a target = "_blank" href = { sanitizeUrl ( termsOfService ) } > Terms of service</ a >
137+ < Link target = "_blank" href = { sanitizeUrl ( termsOfService ) } > Terms of service</ Link >
124138 </ div >
125139 }
126140
127- { contact && contact . size ? < Contact data = { contact } /> : null }
128- { license && license . size ? < License license = { license } /> : null }
141+ { contact && contact . size ? < Contact getComponent = { getComponent } data = { contact } /> : null }
142+ { license && license . size ? < License getComponent = { getComponent } license = { license } /> : null }
129143 { externalDocsUrl ?
130- < a target = "_blank" href = { sanitizeUrl ( externalDocsUrl ) } > { externalDocsDescription || externalDocsUrl } </ a >
144+ < Link target = "_blank" href = { sanitizeUrl ( externalDocsUrl ) } > { externalDocsDescription || externalDocsUrl } </ Link >
131145 : null }
132146
133147 </ div >
0 commit comments