This repository has been archived on 2025-11-02. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
parandum/src/ProgressStats.js
Matthew Grove 42cfa1d619 Add new lives mode and more test options!
Users can now choose from two modes - lives and questions. Lives mode will end when the user makes the chosen number of mistakes. Questions mode will end when the user answers all questions correctly from a list of questions the length of which the user chooses.
2021-09-12 20:26:45 +01:00

42 lines
1.1 KiB
JavaScript

import React from "react";
export default function ProgressStats(props) {
return (
<div className="progress-stats">
<div className="progress-stat-row-container">
<div className="stat-row stat-row--inline stat-row--no-gap">
<h1>{props.grade.toFixed(2)}</h1>
<p>%</p>
</div>
<div className="stat-row stat-row--inline">
<h1>{props.correct}</h1>
{
props.maxQuestions
?
<>
<p>correct of</p>
<h1>{props.maxQuestions}</h1>
<p>possible questions</p>
</>
:
<p>correct</p>
}
</div>
<div className="stat-row stat-row--inline">
<h1>{props.incorrect}</h1>
<p>mistake{ props.incorrect !== 1 && "s" }</p>
</div>
<div className="stat-row stat-row--inline">
<h1>{props.progress}</h1>
<p>guess{props.progress !== 1 && "es"}</p>
</div>
</div>
<div className="progress-bar">
<div style={{ width: props.progressNumerator > 0 && props.progressDenominator > 0 ? `${(props.progressNumerator / props.progressDenominator * 100)}%` : "0" }}>
<p>{props.progressNumerator}/{props.progressDenominator}</p>
</div>
</div>
</div>
)
}