Passed
Pull Request — develop (#758)
by Kevin Van
10:04 queued 05:43
created

srcBU/components/PlayerTeaser.tsx   A

Complexity

Total Complexity 1
Complexity/F 0

Size

Lines of Code 48
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 41
mnd 1
bc 1
fnc 0
dl 0
loc 48
rs 10
bpm 0
cpm 0
noi 0
c 0
b 0
f 0
1
// importing FunctionComponent
2
import { Link } from "gatsby"
3
import { GatsbyImage, StaticImage } from "gatsby-plugin-image"
4
import React, { FunctionComponent } from "react"
5
6
import "./PlayerTeaser.scss"
7
import { PlayerTeaserProps } from "./PlayerTeaser.types"
8
9
const PlayerTeaser: FunctionComponent<PlayerTeaserProps> = ({ url, position, first_name, last_name, picture }) => {
10
  let image
11
  if (!picture) {
12
    image = (
13
      <StaticImage
14
        src={`../images/kcvv-player-bg.png`}
15
        alt={`"${first_name} ${last_name}"`}
16
        placeholder={`tracedSVG`}
17
      />
18
    )
19
  } else {
20
    image = <GatsbyImage image={picture} alt={`"${first_name} ${last_name}"`} />
21
  }
22
23
  return (
24
    <article className={`player_teaser`}>
25
      <Link to={url}>
26
        <div className={`player_teaser__image`}>
27
          {image}
28
          <div className={`player_teaser__gradient`}></div>
29
        </div>
30
        <div className={`player_teaser__info`}>
31
          <div className={`player_teaser__info__number`}>{position}</div>
32
          <div className={`player_teaser__info__firstname`}>{first_name}</div>
33
          <div className={`player_teaser__info__lastname`}>{last_name}</div>
34
        </div>
35
      </Link>
36
    </article>
37
  )
38
}
39
40
PlayerTeaser.defaultProps = {
41
  url: `#`,
42
  position: ``,
43
  first_name: ``,
44
  last_name: ``,
45
}
46
47
export default PlayerTeaser
48