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