-
Notifications
You must be signed in to change notification settings - Fork 12
/
LinkLabel.jsx
32 lines (29 loc) · 961 Bytes
/
LinkLabel.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
import React from 'react';
import { Link as LinkIcon } from '@mui/icons-material';
import { merge } from 'lodash';
import { formatWebsiteLink } from '../../common/utils';
const STYLES = {
medium: {
icon: {width: '9.5pt', marginTop: '-3px', marginRight: '4px'},
fontSize: '9.5pt',
},
small: {
icon: {width: '8pt', marginTop: '-4px', marginRight: '4px'},
fontSize: '8pt',
}
}
const LinkLabel = props => {
const containerClass = props.noContainerClass ? '' : 'col-sm-12 no-side-padding';
const styles = STYLES[props.iconSize || 'small']
return (
<div className={`${containerClass} resource-metadata`} style={merge({fontSize: styles.fontSize}, (props.containerStyle || {}))}>
<span>
<LinkIcon style={styles.icon} />
</span>
<span className='ellipsis-text' style={{maxWidth: '300px'}}>
{formatWebsiteLink(props.link, {color: 'inherit'})}
</span>
</div>
)
}
export default LinkLabel;