| Total Complexity | 14 |
| Complexity/F | 0 |
| Lines of Code | 33 |
| Function Count | 0 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import { LineupPlayer, LineupProps, LineupStaff } from "../Types/Lineup" |
||
| 2 | import "./Lineup.scss" |
||
| 3 | import PlayerTeaser from "./PlayerTeaser" |
||
| 4 | import React from "react" |
||
| 5 | |||
| 6 | const isPlayer = (object: LineupPlayer | LineupStaff): object is LineupPlayer => `field_shirtnumber` in (object || {}) |
||
| 7 | |||
| 8 | const Lineup = ({ title = ``, lineup }: LineupProps) => { |
||
| 9 | return ( |
||
| 10 | <section className="team__lineup__section"> |
||
| 11 | {title && <h2 className="after-border">{title}</h2>} |
||
| 12 | <ul> |
||
| 13 | {lineup?.map((player, i) => { |
||
| 14 | return ( |
||
| 15 | <li className={`team__lineup__item`} key={i}> |
||
| 16 | <PlayerTeaser |
||
| 17 | url={player?.path?.alias || ``} |
||
| 18 | position={ |
||
| 19 | (isPlayer(player) ? player?.field_shirtnumber?.toString() : player?.field_position_short) || `` |
||
| 20 | } |
||
| 21 | first_name={player?.field_firstname || ``} |
||
| 22 | last_name={player?.field_lastname || ``} |
||
| 23 | picture={player?.relationships?.field_image?.localFile?.childImageSharp?.gatsbyImageData} |
||
| 24 | /> |
||
| 25 | </li> |
||
| 26 | ) |
||
| 27 | })} |
||
| 28 | </ul> |
||
| 29 | </section> |
||
| 30 | ) |
||
| 31 | } |
||
| 32 | export default Lineup |
||
| 33 |