Passed
Push — master ( 912bac...4ae8cd )
by Guangyu
05:25 queued 11s
created

src/components/experience/ExperienceSummary.js   A

Complexity

Total Complexity 1
Complexity/F 0

Size

Lines of Code 54
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 49
mnd 1
bc 1
fnc 0
dl 0
loc 54
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 { Button, Media } from 'reactstrap';
4
import { Link } from 'react-router-dom';
5
import Verified from '../common/Verified';
6
import Avatar from '../common/Avatar';
7
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
8
9
const ExperienceSummary = ({ imgSrc, headline, company, duration, location, divider, verified, isEditable, to }) => (
10
  <Media>
11
    <Link to={to}>
12
      {imgSrc ? <img className="img-fluid" src={imgSrc} width={56} alt="" /> : <Avatar name={company} size="3xl" />}
13
    </Link>
14
    <Media body className="position-relative pl-3 btn-reveal-trigger">
15
      <h6 className="fs-0 mb-0 d-flex justify-content-between align-items-start">
16
        <span>
17
          {headline}
18
          {verified && <Verified />}
19
        </span>
20
        {isEditable && (
21
          <Button color="link" className="btn-reveal py-0 px-2">
22
            <FontAwesomeIcon icon="pencil-alt" />
23
          </Button>
24
        )}
25
      </h6>
26
      <p className="mb-1">
27
        <Link to={to}>{company}</Link>
28
      </p>
29
      <p className="text-1000 mb-0">{duration}</p>
30
      <p className="text-1000 mb-0">{location}</p>
31
      {divider && <hr className="border-dashed border-bottom-0" />}
32
    </Media>
33
  </Media>
34
);
35
36
ExperienceSummary.propTypes = {
37
  headline: PropTypes.string.isRequired,
38
  company: PropTypes.string.isRequired,
39
  duration: PropTypes.string.isRequired,
40
  location: PropTypes.string.isRequired,
41
  to: PropTypes.string.isRequired,
42
  imgSrc: PropTypes.string,
43
  divider: PropTypes.bool,
44
  verified: PropTypes.bool,
45
  isEditable: PropTypes.bool
46
};
47
48
ExperienceSummary.defaultProps = {
49
  divider: true,
50
  verified: false
51
};
52
53
export default ExperienceSummary;
54