Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ICAT
Datahub
Commits
03515b2a
Commit
03515b2a
authored
Aug 25, 2020
by
Axel Bocciarelli
Browse files
Make DOIBadge functional and remove duplicated ID
parent
98e1128e
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/components/doi/DOIBadge.js
View file @
03515b2a
...
...
@@ -2,29 +2,26 @@ import React from 'react';
import
{
Glyphicon
}
from
'
react-bootstrap
'
;
import
'
./DOIBadge.css
'
;
class
DOIBadge
extends
React
.
Component
{
render
()
{
if
(
this
.
props
.
doi
)
{
if
(
this
.
props
.
doi
.
trim
()
!==
''
)
{
const
doiUrl
=
`https://doi.esrf.fr/
${
this
.
props
.
doi
}
`
;
return
(
<
span
className
=
"
doiBadge borderRadius-5
"
>
DOI
<
a
id
=
"
doiLink
"
target
=
"
_blank
"
rel
=
"
noopener noreferrer
"
href
=
{
doiUrl
}
>
{
this
.
props
.
doi
}
<
/a
>
<
/span
>
);
}
return
null
;
}
function
DOIBadge
(
props
)
{
const
{
doi
}
=
props
;
if
(
!
doi
)
{
return
<
Glyphicon
glyph
=
"
lock
"
/>
;
}
if
(
doi
.
trim
()
===
''
)
{
return
null
;
}
const
doiUrl
=
`https://doi.esrf.fr/
${
doi
}
`
;
return
(
<
span
className
=
"
doiBadge borderRadius-5
"
>
DOI
<
a
target
=
"
_blank
"
rel
=
"
noopener noreferrer
"
href
=
{
doiUrl
}
>
{
doi
}
<
/a
>
<
/span
>
);
}
export
default
DOIBadge
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment