aboutsummaryrefslogtreecommitdiff
path: root/src/components/Scoreboard
diff options
context:
space:
mode:
authorEug-VS <eug-vs@keemail.me>2020-01-05 03:13:24 +0300
committerEug-VS <eug-vs@keemail.me>2020-01-05 03:14:46 +0300
commitdd622def55c52255493c467e2be2f8e3473a1256 (patch)
tree3419507e0b66bf46d728795dcbbd91b49607eacb /src/components/Scoreboard
parent321674f2710910f87893b4d0e65e67b77d1ebaa4 (diff)
downloadchrono-cube-ui-dd622def55c52255493c467e2be2f8e3473a1256.tar.gz
Add DELETE as menu option to SolutionCard
Diffstat (limited to 'src/components/Scoreboard')
-rw-r--r--src/components/Scoreboard/Scoreboard.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/components/Scoreboard/Scoreboard.js b/src/components/Scoreboard/Scoreboard.js
index 48d3c8a..039b951 100644
--- a/src/components/Scoreboard/Scoreboard.js
+++ b/src/components/Scoreboard/Scoreboard.js
@@ -27,6 +27,10 @@ const Scoreboard = () => {
await setSolutions(response.data);
};
+ const removeSolution = (id) => {
+ setSolutions(solutions.filter((solution => solution.id !== id)));
+ };
+
useEffect(() => {
updateSolutions();
}, []);
@@ -39,7 +43,7 @@ const Scoreboard = () => {
<Grid container justify="center" direction="column" spacing={3}>
{solutions.map(solution => (
<Grid item>
- <SolutionCard solution={solution}/>
+ <SolutionCard solution={solution} removeThisCard={removeSolution}/>
</Grid>
))}
</Grid>