| Total Complexity | 1 |
| Complexity/F | 0 |
| Lines of Code | 47 |
| Function Count | 0 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | // importing FunctionComponent |
||
| 2 | import { PlayerTeaserProps } from "../Types/PlayerTeaser" |
||
| 3 | import "./PlayerTeaser.scss" |
||
| 4 | import { Link } from "gatsby" |
||
| 5 | import { GatsbyImage, StaticImage } from "gatsby-plugin-image" |
||
| 6 | import React from "react" |
||
| 7 | |||
| 8 | const PlayerTeaser = ({ url, position, first_name, last_name, picture }: PlayerTeaserProps) => { |
||
| 9 | let image |
||
| 10 | if (!picture) { |
||
| 11 | image = ( |
||
| 12 | <StaticImage src={`../images/kcvv-player-bg.png`} alt={`"${first_name} ${last_name}"`} placeholder={`blurred`} /> |
||
| 13 | ) |
||
| 14 | } else { |
||
| 15 | image = <GatsbyImage image={picture} alt={`"${first_name} ${last_name}"`} /> |
||
| 16 | } |
||
| 17 | |||
| 18 | return ( |
||
| 19 | <article className={`player__teaser`}> |
||
| 20 | <Link to={url} title={`${position} - ${first_name} ${last_name}`}> |
||
| 21 | <div className={`player__teaser__bg`}> |
||
| 22 | <StaticImage src={`../images/player-bg.jpg`} alt="" /> |
||
| 23 | </div> |
||
| 24 | <div className={`player__teaser__image`}>{image}</div> |
||
| 25 | <span className={`player__teaser__position`}>{position}</span> |
||
| 26 | <div className={`player_teaser__name__wrapper`}> |
||
| 27 | <div className={`player_teaser__name player_teaser__name--first`} title={`${first_name} ${last_name}`}> |
||
| 28 | {first_name} |
||
| 29 | </div> |
||
| 30 | <div className={`player_teaser__name player_teaser__name--last`} title={`${first_name} ${last_name}`}> |
||
| 31 | {last_name} |
||
| 32 | </div> |
||
| 33 | </div> |
||
| 34 | </Link> |
||
| 35 | </article> |
||
| 36 | ) |
||
| 37 | } |
||
| 38 | |||
| 39 | PlayerTeaser.defaultProps = { |
||
| 40 | url: `#`, |
||
| 41 | position: ``, |
||
| 42 | first_name: ``, |
||
| 43 | last_name: ``, |
||
| 44 | } |
||
| 45 | |||
| 46 | export default PlayerTeaser |
||
| 47 |