Add stats during a test

This commit is contained in:
2021-09-11 22:16:13 +01:00
parent 20fbda3b22
commit 7e2d747da6
3 changed files with 190 additions and 94 deletions

31
src/ProgressStats.js Normal file
View File

@@ -0,0 +1,31 @@
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>
<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.correct > 0 && props.totalVocabItems > 0 ? `${(props.correct / props.totalVocabItems * 100)}%` : "0" }}>
<p>{props.correct}/{props.totalVocabItems}</p>
</div>
</div>
</div>
)
}