diff options
author | Eug-VS <eug-vs@keemail.me> | 2020-01-07 00:38:07 +0300 |
---|---|---|
committer | Eug-VS <eug-vs@keemail.me> | 2020-01-07 00:38:07 +0300 |
commit | 4b07be9d2ec37f65de7d1a2c8012815d7baa599c (patch) | |
tree | 23e359908a8e65dd1067a8f9f4d7a57c8522da13 /src/components/TimerPage | |
parent | 1df3d81437af73b35b65c8e2ac18e935a3acf544 (diff) | |
download | chrono-cube-ui-4b07be9d2ec37f65de7d1a2c8012815d7baa599c.tar.gz |
Support deleting cards on TimerPage
Diffstat (limited to 'src/components/TimerPage')
-rw-r--r-- | src/components/TimerPage/TimerPage.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/components/TimerPage/TimerPage.js b/src/components/TimerPage/TimerPage.js index 968faab..f304b46 100644 --- a/src/components/TimerPage/TimerPage.js +++ b/src/components/TimerPage/TimerPage.js @@ -32,16 +32,20 @@ const TimerPage = ({ recentSolutions, setRecentSolutions }) => { }); }; + const removeSolution = (id) => { + setRecentSolutions(recentSolutions.filter((solution => solution.id !== id))); + }; + return ( <Box className={classes.root}> <Grid container direction="row" justify="space-around" spacing={8}> <Grid item xs={6}> <Timer registerResult={registerResult} style={{ position: 'fixed' }}/> </Grid> - <Grid item xs={4} container direction="column" spacing={6}> - {recentSolutions.slice(0, 5).map(solution => ( + <Grid item xs={4} container direction="column" spacing={5}> + {recentSolutions.slice(0, 3).map(solution => ( <Grid item key={solution.id}> - <SolutionCard data={solution} /> + <SolutionCard data={solution} removeThisCard={removeSolution}/> </Grid> ))} </Grid> |