Commit 03515b2a authored by Axel Bocciarelli's avatar Axel Bocciarelli
Browse files

Make DOIBadge functional and remove duplicated ID

parent 98e1128e
......@@ -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;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment