Skip to content

Commit

Permalink
DocumentTitle: Use first result of relations List
Browse files Browse the repository at this point in the history
  • Loading branch information
sakshamarora1 committed May 26, 2024
1 parent eff4615 commit c5b5975
Showing 1 changed file with 12 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,16 @@ export class DocumentTitle extends Component {
}

relationsTitle(relationsData) {
const relation = relationsData[0];
return !_isEmpty(relationsData) ? (
<Header.Subheader>
{relationsData.map((rel, index) => (
<>
<Link key={rel.pid_value} to={this.getLinkTo(rel)}>
{rel.record_metadata.title}
</Link>
{index === relationsData.length - 1 ? ' featuring:' : ' and '}
</>
))}
</Header.Subheader>
<Header>
<Header.Subheader>
<Link to={this.getLinkTo(relation)}>
{relation.record_metadata.title}
</Link>
{' featuring:'}
</Header.Subheader>
</Header>
) : null;
}

Expand All @@ -48,11 +47,9 @@ export class DocumentTitle extends Component {

return (
<>
<Header>
{this.relationsTitle(
_get(metadata, 'relations.multipart_monograph', [])
)}
</Header>
{this.relationsTitle(
_get(metadata, 'relations.multipart_monograph', [])
)}
<Media greaterThanOrEqual="tablet">
<Grid columns={2}>
<Grid.Row className="pb-0">
Expand Down

0 comments on commit c5b5975

Please sign in to comment.