-
Notifications
You must be signed in to change notification settings - Fork 12
/
FromConceptLabelVertical.jsx
39 lines (38 loc) · 1.72 KB
/
FromConceptLabelVertical.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
36
37
38
39
import React from 'react';
import { Link } from 'react-router-dom';
import { Tooltip } from '@mui/material'
import {LocalOffer as LocalOfferIcon} from '@mui/icons-material'
import { get } from 'lodash';
import ResourceLabelVertical from '../common/ResourceLabelVertical';
import { getSiteTitle } from '../../common/utils';
const SITE_TITLE = getSiteTitle()
const FromConceptLabelVertical = props => {
const conceptName = props.from_concept_name || props.from_concept_name_resolved || get(props, 'from_concept.display_name')
const existsInOCL = Boolean(props.from_concept_url)
const labelComponent = <ResourceLabelVertical
resource='concept'
owner={props.from_source_owner}
parent={props.from_source_name}
id={props.from_concept_code}
parentURL={props.from_source_url}
name={conceptName}
icon={
<Tooltip title={existsInOCL ? `Defined in ${SITE_TITLE}` : `Not defined in ${SITE_TITLE}`}>
<LocalOfferIcon
color={existsInOCL ? 'primary': 'warning'}
fontSize='small'
style={{width: '14pt'}}
/>
</Tooltip>
} />;
return (
<React.Fragment>
{
!props.noRedirect && props.from_concept_url ?
<Link to={props.from_concept_url} style={{display: 'inline-block'}}>{labelComponent}</Link>:
<span>{labelComponent}</span>
}
</React.Fragment>
)
}
export default FromConceptLabelVertical;