Passed
Push — feature/node-16 ( 2d86d4...d617b7 )
by Kevin Van
09:18 queued 03:35
created

src/components/PlayerTeaser.tsx   A

Complexity

Total Complexity 1
Complexity/F 0

Size

Lines of Code 46
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

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