1
- import classNames from 'classnames' ;
2
1
import format from 'date-fns/format' ;
3
2
import _ from 'lodash' ;
4
3
import React from 'react' ;
@@ -9,10 +8,9 @@ import {GameInfo, Team, TeamId, TVNetwork} from '../models';
9
8
import teamsJson from '../resources/teams.json' ;
10
9
import {
11
10
AwayGamePrefix ,
12
- AwayGameWrapper ,
13
11
DateOpponentDetailsWrapper ,
14
12
GameDate ,
15
- HomeGameWrapper ,
13
+ GameWrapper ,
16
14
Location ,
17
15
OpponentDetailsWrapper ,
18
16
OpponentLogo ,
@@ -39,13 +37,13 @@ export const Game: React.FC<{
39
37
let lastColumnContent : React . ReactNode ;
40
38
if ( game . isCanceled ) {
41
39
lastColumnContent = (
42
- < TelevisionCoverage network = { TVNetwork . Unknown } >
40
+ < TelevisionCoverage $ network= { TVNetwork . Unknown } >
43
41
< p > Canceled</ p >
44
42
</ TelevisionCoverage >
45
43
) ;
46
44
} else if ( game . isPostponed ) {
47
45
lastColumnContent = (
48
- < TelevisionCoverage network = { TVNetwork . Unknown } >
46
+ < TelevisionCoverage $ network= { TVNetwork . Unknown } >
49
47
< p > Posponed</ p >
50
48
</ TelevisionCoverage >
51
49
) ;
@@ -71,14 +69,10 @@ export const Game: React.FC<{
71
69
) ;
72
70
}
73
71
74
- const scoreTotalClasses = classNames ( {
75
- 'overtime-game' : game . numOvertimes ,
76
- } ) ;
77
-
78
72
lastColumnContent = (
79
73
< Score >
80
74
{ scoreResult }
81
- < ScoreTotals className = { scoreTotalClasses } >
75
+ < ScoreTotals $isOvertimeGame = { ( game . numOvertimes ?? 0 ) > 0 } >
82
76
< p >
83
77
{ notreDameScore } - { opponentScore }
84
78
</ p >
@@ -91,7 +85,7 @@ export const Game: React.FC<{
91
85
92
86
lastColumnContent = (
93
87
< TelevisionCoverage
94
- network = { game . coverage === 'TBD' ? TVNetwork . Unknown : game . coverage ?? TVNetwork . Unknown }
88
+ $ network= { game . coverage === 'TBD' ? TVNetwork . Unknown : game . coverage ?? TVNetwork . Unknown }
95
89
>
96
90
< p > { time } </ p >
97
91
{ game . coverage && game . coverage !== 'TBD' ? (
@@ -101,18 +95,12 @@ export const Game: React.FC<{
101
95
) ;
102
96
} else {
103
97
lastColumnContent = (
104
- < TelevisionCoverage network = { TVNetwork . Unknown } >
98
+ < TelevisionCoverage $ network= { TVNetwork . Unknown } >
105
99
< p > TBD</ p >
106
100
</ TelevisionCoverage >
107
101
) ;
108
102
}
109
103
110
- const gameClassNames = classNames ( {
111
- selected : isSelected ,
112
- homeGame : game . isHomeGame ,
113
- awayGame : ! game . isHomeGame ,
114
- } ) ;
115
-
116
104
let gameDate : Date | 'TBD' | undefined ;
117
105
if ( game . fullDate ) {
118
106
gameDate = new Date ( game . fullDate ) ;
@@ -139,8 +127,6 @@ export const Game: React.FC<{
139
127
_ . get ( game , 'rankings.home.cfbPlayoff' ) ||
140
128
_ . get ( game , 'rankings.home.ap' ) ;
141
129
142
- const WrapperComponent = game . isHomeGame ? HomeGameWrapper : AwayGameWrapper ;
143
-
144
130
let shamrockSeriesLogoContent : React . ReactNode = null ;
145
131
if ( game . isShamrockSeries ) {
146
132
shamrockSeriesLogoContent = (
@@ -174,7 +160,11 @@ export const Game: React.FC<{
174
160
}
175
161
176
162
return (
177
- < WrapperComponent className = { gameClassNames } to = { `/${ season } /${ index + 1 } /` } >
163
+ < GameWrapper
164
+ to = { `/${ season } /${ index + 1 } /` }
165
+ $isSelected = { isSelected }
166
+ $isHomeGame = { game . isHomeGame }
167
+ >
178
168
< OpponentWrapper >
179
169
< OpponentLogo teamId = { game . opponentId } />
180
170
< DateOpponentDetailsWrapper >
@@ -191,6 +181,6 @@ export const Game: React.FC<{
191
181
{ shamrockSeriesLogoContent }
192
182
</ Location >
193
183
{ lastColumnContent }
194
- </ WrapperComponent >
184
+ </ GameWrapper >
195
185
) ;
196
186
} ;
0 commit comments