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