-
Notifications
You must be signed in to change notification settings - Fork 12
/
ConceptDetailsLocale.jsx
52 lines (48 loc) · 1.96 KB
/
ConceptDetailsLocale.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
40
41
42
43
44
45
46
47
48
49
50
51
52
import React from 'react';
import { Flag as FlagIcon, FileCopy as CopyIcon } from '@mui/icons-material';
import { Chip, Tooltip, IconButton } from '@mui/material';
import { get } from 'lodash';
import ExternalIdLabel from '../common/ExternalIdLabel';
import { toFullAPIURL, copyURL } from '../../common/utils';
const ConceptDetailsLocale = ({ locale, isDescription, url }) => {
const typeAttr = isDescription ? 'description_type' : 'name_type'
const nameAttr = isDescription ? 'description' : 'name'
const type = get(locale, typeAttr);
const onCopyClick = () => copyURL(toFullAPIURL(url))
return (
<div className='col-md-12 flex-vertical-center'>
<div className='col-md-11 no-left-padding'>
<div className='col-md-12 no-side-padding flex-vertical-center'>
<span style={{marginRight: '10px'}}>{ get(locale, nameAttr) }</span>
{
type &&
<span style={{marginRight: '10px'}}>
<Chip style={{height: '20px', fontSize: '10px'}} size='small' label={type} />
</span>
}
<span className='gray-italics-small'>{`[${locale.locale}]`}</span>
{
locale.locale_preferred &&
<span style={{marginRight: '5px'}}>
<Tooltip arrow title={`Preferred ${nameAttr} for this locale`} placement='top-start'>
<FlagIcon color='secondary' fontSize='small' style={{width: '18px', marginTop: '4px'}}/>
</Tooltip>
</span>
}
</div>
{
locale.external_id &&
<ExternalIdLabel externalId={locale.external_id} iconSize='small' />
}
</div>
<div className='col-md-1 no-right-padding'>
<Tooltip arrow title='Copy Link' placement='right'>
<IconButton onClick={onCopyClick} color='primary' size='small'>
<CopyIcon fontSize='inherit' />
</IconButton>
</Tooltip>
</div>
</div>
);
}
export default ConceptDetailsLocale;