-
Notifications
You must be signed in to change notification settings - Fork 12
/
Contact.jsx
45 lines (39 loc) · 1.03 KB
/
Contact.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
import React from 'react';
import { Divider } from '@mui/material'
import { isEmpty, map } from 'lodash';
const Contact = ({name, telecom}) => {
const getHREF = (system, value) => {
if(system === 'url')
return value
if(system === 'email')
return `mailto:${value}`
if(system === 'phone')
return `tel:${value}`
}
return (
<span className='flex-vertical-center'>
{
name &&
<span>{name}</span>
}
{
!isEmpty(telecom) &&
map(
telecom,
(com, index) => (
<React.Fragment key={index}>
<a style={{marginLeft: '10px'}} href={getHREF(com.system, com.value)} rel="noopener noreferrer" target='_blank'>
{com.value}
</a>
{
(index !== telecom.length - 1) &&
<Divider orientation="vertical" style={{height: '16px', marginLeft: '10px'}} />
}
</React.Fragment>
)
)
}
</span>
)
}
export default Contact;