src/components/CV/TopSection/Call.js   A
last analyzed

Complexity

Total Complexity 1
Complexity/F 0

Size

Lines of Code 44
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 34
mnd 1
bc 1
fnc 0
dl 0
loc 44
rs 10
bpm 0
cpm 0
noi 0
c 0
b 0
f 0
1
import React from 'react'
2
import PropTypes from 'prop-types'
3
import { makeStyles } from '@material-ui/core/styles'
4
import CallIcon from '@material-ui/icons/Call'
5
import Tooltip from '@material-ui/core/Tooltip'
6
import topStyle from './index.scss'
7
8
const useStyles = makeStyles({
9
  tooltip: {
10
    fontSize: '0.8rem',
11
    textAlign: 'center',
12
  },
13
})
14
15
const Call = ({ tel, title }) => {
16
  const classes = useStyles()
17
  const b = (
18
    <button
19
      type="button"
20
      className={`${topStyle.svgwrapper} ${topStyle.call}`}
21
      onClick={() => {
22
        window.location.href = `tel:${tel}`
23
      }}
24
    >
25
      <CallIcon />
26
    </button>
27
  )
28
  if (title) {
29
    return (
30
      <Tooltip classes={{ tooltip: classes.tooltip }} title={title}>
31
        {b}
32
      </Tooltip>
33
    )
34
  }
35
  return b
36
}
37
38
Call.propTypes = {
39
  tel: PropTypes.string.isRequired,
40
  title: PropTypes.string,
41
}
42
43
export default Call
44