|
@@ -1,7 +1,7 @@
|
|
|
import React from 'react';
|
|
|
-import styles from './PlayerScores.module.css';
|
|
|
+import styles from './ScoreBoard.module.css';
|
|
|
|
|
|
-export default ({ name, guesses, totalScore }) => (
|
|
|
+const PlayerScoreTile = ({ name, guesses, totalScore }) => (
|
|
|
<div className={styles.tile}>
|
|
|
<span className={styles.name}>{name}</span>
|
|
|
<span className={styles.total}>Score: {totalScore}</span>
|
|
@@ -20,3 +20,12 @@ export default ({ name, guesses, totalScore }) => (
|
|
|
</div>
|
|
|
</div>
|
|
|
);
|
|
|
+
|
|
|
+export default ({ players }) => (
|
|
|
+ <div className={styles.scoreboard}>
|
|
|
+ {players
|
|
|
+ .filter(({ currentRound }) => currentRound === null)
|
|
|
+ .sort((p1, p2) => (p1.totalScore > p2.totalScore ? -1 : p1.totalScore < p2.totalScore ? 1 : 0))
|
|
|
+ .map((data) => <PlayerScoreTile key={data.name} {...data} />)}
|
|
|
+ </div>
|
|
|
+);
|