@@ -4,7 +4,6 @@ import type {
44 FootballMatchTeamWithStats ,
55} from '../footballMatchStats' ;
66import type { FootballTable as FootballTableData } from '../footballTables' ;
7- import { grid } from '../grid' ;
87import { FootballMatchStat } from './FootballMatchStat' ;
98import { LeagueTable } from './LeagueTable' ;
109import { Lineups } from './Lineups' ;
@@ -14,6 +13,12 @@ type Props = {
1413 table ?: FootballTableData ;
1514} ;
1615
16+ const layoutCss = css `
17+ display : flex;
18+ flex-direction : column;
19+ gap : 10px ;
20+ ` ;
21+
1722function teamHasStats ( {
1823 shotsOffTarget,
1924 shotsOnTarget,
@@ -34,86 +39,54 @@ export const FootballMatchInfo = ({ match, table }: Props) => {
3439 const showLineups =
3540 match . homeTeam . players . length > 0 && match . awayTeam . players . length > 0 ;
3641 return (
37- < section aria-label = { 'match-info' } >
42+ < section aria-label = { 'match-info' } css = { layoutCss } >
3843 { showStats && (
3944 < >
40- < StatsContainer
45+ < FootballMatchStat
4146 label = "Possession"
42- match = { match }
47+ homeTeam = { {
48+ name : match . homeTeam . name ,
49+ colour : match . homeTeam . statsColour ,
50+ } }
51+ awayTeam = { {
52+ name : match . awayTeam . name ,
53+ colour : match . awayTeam . statsColour ,
54+ } }
4355 homeValue = { match . homeTeam . possession }
4456 awayValue = { match . awayTeam . possession }
4557 isPercentage = { true }
4658 />
4759 { /* Add Goal Attempts here */ }
48- < StatsContainer
60+ < FootballMatchStat
4961 label = "Corners"
50- match = { match }
62+ homeTeam = { {
63+ name : match . homeTeam . name ,
64+ colour : match . homeTeam . statsColour ,
65+ } }
66+ awayTeam = { {
67+ name : match . awayTeam . name ,
68+ colour : match . awayTeam . statsColour ,
69+ } }
5170 homeValue = { match . homeTeam . corners }
5271 awayValue = { match . awayTeam . corners }
5372 />
54- < StatsContainer
73+ < FootballMatchStat
5574 label = "Fouls"
56- match = { match }
75+ homeTeam = { {
76+ name : match . homeTeam . name ,
77+ colour : match . homeTeam . statsColour ,
78+ } }
79+ awayTeam = { {
80+ name : match . awayTeam . name ,
81+ colour : match . awayTeam . statsColour ,
82+ } }
5783 homeValue = { match . homeTeam . fouls }
5884 awayValue = { match . awayTeam . fouls }
5985 />
6086 </ >
6187 ) }
62-
63- { showLineups && (
64- < div
65- css = { css `
66- padding-bottom : 10px ;
67- ` }
68- >
69- < Lineups matchStats = { match } />
70- </ div >
71- ) }
72- { table && (
73- < div
74- css = { css `
75- padding-bottom : 10px ;
76- ` }
77- >
78- < LeagueTable table = { table } />
79- </ div >
80- ) }
88+ { showLineups && < Lineups matchStats = { match } /> }
89+ { table && < LeagueTable table = { table } /> }
8190 </ section >
8291 ) ;
8392} ;
84-
85- const StatsContainer = ( {
86- label,
87- match,
88- homeValue,
89- awayValue,
90- isPercentage = false ,
91- } : {
92- label : string ;
93- match : FootballMatchStats ;
94- homeValue : number ;
95- awayValue : number ;
96- isPercentage ?: boolean ;
97- } ) => (
98- < div
99- css = { css `
100- ${ grid . column . centre }
101- padding-bottom : 10px ;
102- ` }
103- >
104- < FootballMatchStat
105- label = { label }
106- homeTeam = { {
107- name : match . homeTeam . name ,
108- colour : match . homeTeam . statsColour ,
109- } }
110- awayTeam = { {
111- name : match . awayTeam . name ,
112- colour : match . awayTeam . statsColour ,
113- } }
114- homeValue = { homeValue }
115- awayValue = { awayValue }
116- isPercentage = { isPercentage }
117- />
118- </ div >
119- ) ;
0 commit comments