Passed
Push — feature/full-redesign ( 15ceb9...e2df01 )
by Kevin Van
04:43
created

src/components/PlayerTeaser.tsx   A

Complexity

Total Complexity 1
Complexity/F 0

Size

Lines of Code 52
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 42
mnd 1
bc 1
fnc 0
dl 0
loc 52
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 from "react"
5
import { PlayerTeaserProps } from "../Types/PlayerTeaser"
6
7
import "./PlayerTeaser.scss"
8
9
const PlayerTeaser = ({ url, position, first_name, last_name, picture }: PlayerTeaserProps) => {
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__bg`}>
27
          <StaticImage src={`../images/player-bg.jpg`} alt="" />
28
        </div>
29
        <div className={`player__teaser__image`}>{image}</div>
30
        <span className={`player__teaser__position`}>{position}</span>
31
        <div className={`player_teaser__name__wrapper`}>
32
          <div className={`player_teaser__name player_teaser__name--first`}>{first_name}</div>
33
          <div className={`player_teaser__name player_teaser__name--last`}>{last_name}</div>
34
        </div>
35
        {/* <div className={`player_teaser__info`}>
36
          <div className={`player_teaser__info__number`}>{position}</div>
37
38
        </div> */}
39
      </Link>
40
    </article>
41
  )
42
}
43
44
PlayerTeaser.defaultProps = {
45
  url: `#`,
46
  position: ``,
47
  first_name: ``,
48
  last_name: ``,
49
}
50
51
export default PlayerTeaser
52