-
Notifications
You must be signed in to change notification settings - Fork 12
/
ToConceptLabel.jsx
35 lines (34 loc) · 1.42 KB
/
ToConceptLabel.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import React from 'react';
import { Link } from 'react-router-dom';
import {LocalOffer as LocalOfferIcon} from '@mui/icons-material'
import { get } from 'lodash';
import ResourceLabel from '../common/ResourceLabel';
import { DARKGRAY } from '../../common/constants';
const ToConceptLabel = props => {
const conceptName = props.to_concept_name || props.to_concept_name_resolved || get(props, 'to_concept.display_name')
const hasLink = props.to_concept_url && !props.noRedirect;
const labelComponent = <ResourceLabel
resource='concept'
existsInOCL={Boolean(props.to_concept_url)}
owner={props.to_source_owner}
parent={props.to_source_name}
id={props.to_concept_code}
parentURL={props.from_source_url}
name={conceptName}
icon={
<LocalOfferIcon
fontSize='small'
style={{width: '10pt', color: DARKGRAY}}
/>
} />;
return (
<React.Fragment>
{
hasLink ?
<Link to={props.to_concept_url} style={{display: 'inline-block'}}>{labelComponent}</Link>:
<span>{labelComponent}</span>
}
</React.Fragment>
)
}
export default ToConceptLabel;