Skip to content

Commit 60e5595

Browse files
authored
Merge pull request #4658 from Clockwork-Rat/WV-881-redirect-when-election-countdown-clicked
Add onlcickandballotforward function
2 parents 7dcfaf4 + 5179e07 commit 60e5595

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

src/js/components/Ready/ElectionCountdown.jsx

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,13 @@ class ElectionCountdown extends React.Component {
107107
}
108108
}
109109

110+
onClickFunctionAndBallotForward = () => {
111+
if (this.props.onClickFunction) {
112+
this.props.onClickFunction();
113+
}
114+
historyPush('/ballot');
115+
}
116+
110117
setNextElectionDateFromDayText = (nextElectionDayText) => {
111118
const daysUntilNextElection = daysUntil(nextElectionDayText);
112119
// console.log('setNextElectionDateFromDayText nextElectionDayText:', nextElectionDayText, ', daysUntilNextElection:', daysUntilNextElection);
@@ -166,19 +173,15 @@ class ElectionCountdown extends React.Component {
166173
<CardTitleUpcoming
167174
className="u-cursor--pointer"
168175
id="electionCountDownTitle"
169-
onClick={() => this.onClickFunctionLocal()}
176+
onClick={() => this.onClickFunctionAndBallotForward}
177+
style={{cursor: 'pointer'}}
170178
>
171179
{daysUntilNextElection ? (
172-
<div
173-
onClick={() => historyPush('/ballot')}
174-
style={{cursor: 'pointer'}}
175-
>
176180
<>
177181
{daysUntilNextElection}
178182
<SpaceBetweenNumberAndWord />
179183
{daysUntilNextElection === 1 ? 'day' : 'days'}
180184
</>
181-
</div>
182185
) : (
183186
<div style={{ margin: 26 }}>
184187
{ showButton ? (
@@ -226,13 +229,8 @@ class ElectionCountdown extends React.Component {
226229
<CardCountdownInternalWrapper>
227230
<div>
228231
<div>
229-
<CardTitleToday className="u-cursor--pointer" id="electionCountDownTitle" onClick={() => this.onClickFunctionLocal()}>
230-
<div
231-
onClick={() => historyPush('/ballot')}
232-
style={{cursor: 'pointer'}}
233-
>
232+
<CardTitleToday className="u-cursor--pointer" id="electionCountDownTitle" onClick={() => this.onClickFunctionAndBallotForward()} style={{cursor: 'pointer'}}>
234233
Voting ends today!
235-
</div>
236234
</CardTitleToday>
237235
</div>
238236
<div>
@@ -257,7 +255,7 @@ class ElectionCountdown extends React.Component {
257255
<div
258256
onClick={() => historyPush('/ballot')}
259257
style={{cursor: 'pointer'}}
260-
>
258+
>
261259
<>
262260
{daysUntilNextNationalElection}
263261
<SpaceBetweenNumberAndWord />

0 commit comments

Comments
 (0)