Skip to content
Snippets Groups Projects
Commit c3a02451 authored by Marjolaine Bodin's avatar Marjolaine Bodin
Browse files

Resolve "Related Resources box"

parent dbc4db10
No related branches found
No related tags found
1 merge request!142Resolve "Related Resources box"
...@@ -12,7 +12,6 @@ import type { DOI } from 'model/doi'; ...@@ -12,7 +12,6 @@ import type { DOI } from 'model/doi';
import { Col, Row } from 'react-bootstrap'; import { Col, Row } from 'react-bootstrap';
import { CONFIG } from 'config/config'; import { CONFIG } from 'config/config';
import { DOIKeywords } from 'components/DOIInfo/DOIKeywords'; import { DOIKeywords } from 'components/DOIInfo/DOIKeywords';
import { DOIReferencesIn } from 'components/DOIInfo/DOIReferencesIn';
export function DOIInfo({ doi }: { doi: DOI }) { export function DOIInfo({ doi }: { doi: DOI }) {
return ( return (
...@@ -49,9 +48,6 @@ export function DOIInfo({ doi }: { doi: DOI }) { ...@@ -49,9 +48,6 @@ export function DOIInfo({ doi }: { doi: DOI }) {
<Col xs={12}> <Col xs={12}>
<DOICited doi={doi} /> <DOICited doi={doi} />
</Col> </Col>
<Col xs={12}>
<DOIReferencesIn doi={doi} />
</Col>
</Row> </Row>
</Col> </Col>
<Col xs={12} lg={5} xl={4} xxl={3}> <Col xs={12} lg={5} xl={4} xxl={3}>
......
import { DOIReferenceURL } from 'components/DOIInfo/DOIReferenceURL';
import type { DOI } from 'model/doi';
import { Card } from 'react-bootstrap';
export function DOIReferencesIn({ doi }: { doi: DOI }) {
if (!doi.referenceURL) {
return null;
}
return (
<Card>
<Card.Header className="p-2">References</Card.Header>
<Card.Body className="p-0">
<DOIReferenceURL doi={doi} />
</Card.Body>
</Card>
);
}
import { LoadReference } from 'components/DOIInfo/DOIReference'; import { LoadReference } from 'components/DOIInfo/DOIReference';
import { DOIReferenceURL } from 'components/DOIInfo/DOIReferenceURL';
import { Loading } from 'components/Loading'; import { Loading } from 'components/Loading';
import type { DOI } from 'model/doi'; import type { DOI } from 'model/doi';
import { Suspense } from 'react'; import { Suspense } from 'react';
import { Card } from 'react-bootstrap'; import { Card } from 'react-bootstrap';
export function DOIRelated({ doi }: { doi: DOI }) { export function DOIRelated({ doi }: { doi: DOI }) {
if ((!doi.relatedDOI || doi.relatedDOI?.length === 0) && !doi.referenceURL) {
return null;
}
return ( return (
<Card> <Card>
<Card.Header className="p-2">Related DOIs</Card.Header> <Card.Header className="p-2">Related Resources</Card.Header>
<Card.Body className="p-0"> <Card.Body className="p-0">
{doi.relatedDOI?.length ? ( {doi.relatedDOI?.map((doi, index, self) => (
doi.relatedDOI?.map((doi, index, self) => ( <div
<div key={doi}
key={doi} className={`p-2 ${
className={`p-2 ${ index === self.length - 1 ? '' : 'border-bottom border-black'
index === self.length - 1 ? '' : 'border-bottom border-black' }`}
}`} >
> <Suspense fallback={<Loading />}>
<Suspense fallback={<Loading />}> <LoadReference doi={doi} />
<LoadReference doi={doi} /> </Suspense>
</Suspense> </div>
</div> ))}
)) <DOIReferenceURL doi={doi} />
) : (
<p className="p-2 m-0">No related DOIs were found.</p>
)}
{}
</Card.Body> </Card.Body>
</Card> </Card>
); );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment