From 224ca5fbd76eb1f1ce4a9055c2d2d0affcd70a10 Mon Sep 17 00:00:00 2001 From: Sendou Date: Fri, 13 Mar 2020 14:06:22 +0200 Subject: [PATCH] vote on maps! --- .../src/components/plus/MapVoteGrid.tsx | 131 ++++++------------ 1 file changed, 45 insertions(+), 86 deletions(-) diff --git a/frontend-react/src/components/plus/MapVoteGrid.tsx b/frontend-react/src/components/plus/MapVoteGrid.tsx index 31d7aba77..720efe11c 100644 --- a/frontend-react/src/components/plus/MapVoteGrid.tsx +++ b/frontend-react/src/components/plus/MapVoteGrid.tsx @@ -37,11 +37,26 @@ const getBg = (value: number) => { interface VotingButtonProps { value: 1 | 0 | -1 handleClick: (oldValue: number) => void + gridArea: string + mode: string } -const VotingButton: React.FC = ({ value, handleClick }) => { +const VotingButton: React.FC = ({ + value, + handleClick, + gridArea, + mode, +}) => { return ( - + + + {mode} + handleClick(value)} alignItems="center" @@ -81,59 +96,32 @@ const MapVoteGrid: React.FC = ({ votes, setVotes }) => { setVotes(copyOfVotes) } return ( - - - - SZ - - - TC - - - RM - - - CB - + <> {votes.map((stage, index) => { return ( - - + + + = ({ votes, setVotes }) => { handleClick={(oldValue: number) => handleClick(index, "sz", oldValue) } + mode="SZ" + gridArea="2 / 1 / 3 / 2" /> handleClick(index, "tc", oldValue) } + mode="TC" + gridArea="2 / 2 / 3 / 3" /> handleClick(index, "rm", oldValue) } + mode="RM" + gridArea="2 / 3 / 3 / 4" /> handleClick(index, "cb", oldValue) } + mode="CB" + gridArea="2 / 4 / 3 / 5" /> - + ) })} - - - SZ - - - TC - - - RM - - - CB - - + ) }