Total Complexity | 1 |
Complexity/F | 0 |
Lines of Code | 44 |
Function Count | 0 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 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 |