Skip to content

Commit

Permalink
Add red to timer when > 10 minutes is elapsed
Browse files Browse the repository at this point in the history
Relates #125
  • Loading branch information
martingaston committed Oct 17, 2018
1 parent 309bf6e commit 4cdf38e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/components/Pages/Revision/ResultsContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import React from "react";
import PropTypes from "prop-types";
import RevisionTitle from "./RevisionTitle";
import timerFormat from "../../../utils/timerFormat";

export default class ResultsContainer extends React.Component {
render() {
Expand All @@ -21,7 +22,8 @@ export default class ResultsContainer extends React.Component {
</li>
<li className="result-list-item">
You performed {this.props.markSchemeCompleted} of{" "}
{this.props.markSchemeTotal} tasks.
{this.props.markSchemeTotal} tasks in{" "}
{timerFormat(this.props.timeElapsed)}.
</li>
</ul>
</div>
Expand All @@ -34,5 +36,6 @@ ResultsContainer.propTypes = {
markSchemeCompleted: PropTypes.number,
markSchemeTotal: PropTypes.number,
markSchemeElements: PropTypes.arrayOf(PropTypes.object),
caseTitle: PropTypes.string
caseTitle: PropTypes.string,
timeElapsed: PropTypes.number
};
1 change: 1 addition & 0 deletions src/components/Pages/Revision/RevisionPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export default class RevisionPage extends React.Component {
markSchemeCompleted={this.state.markSchemeCompleted}
markSchemeElements={this.state.markSchemeElements}
caseTitle={this.state.caseTitle}
timeElapsed={this.state.time}
/>
);
const { exam, station } = this.props.match.params;
Expand Down
4 changes: 4 additions & 0 deletions src/components/Pages/Revision/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,7 @@
display: flex;
justify-content: center;
}

.timer-long {
color: $peter-red;
}
7 changes: 6 additions & 1 deletion src/components/TopBar/TopBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ export default class TopBar extends React.Component {
{this.props.stationName && removeHyphens(this.props.stationName)}
</h3>
{this.props.timer && (
<h3 id="topbar-timer">{timerFormat(this.props.time)}</h3>
<h3
className={this.props.time >= 600 ? `timer-long` : ``}
id="topbar-timer"
>
{timerFormat(this.props.time)}
</h3>
)}
{this.props.tickDisplayed && (
<CompleteButton
Expand Down

0 comments on commit 4cdf38e

Please sign in to comment.