Readded map token remove

This commit is contained in:
Mitchell McCaffrey
2020-05-21 22:57:44 +10:00
parent 05df26491f
commit 118878d9e1
3 changed files with 68 additions and 1 deletions

View File

@@ -0,0 +1,40 @@
import React, { useContext } from "react";
import { Box, IconButton } from "theme-ui";
import RemoveTokenIcon from "../../icons/RemoveTokenIcon";
import MapInteractionContext from "../../contexts/MapInteractionContext";
function TokenDragOverlay({ onTokenStateRemove }) {
const { setPreventMapInteraction } = useContext(MapInteractionContext);
function handleTokenRemove() {
onTokenStateRemove();
setPreventMapInteraction(false);
}
return (
<Box
sx={{
position: "absolute",
bottom: "12px",
left: "50%",
borderRadius: "50%",
transform: "translateX(-50%)",
transition: "transform 250ms ease",
":hover": {
transform: "translateX(-50%) scale(1.5)",
},
}}
bg="overlay"
onMouseUp={handleTokenRemove}
onTouchEnd={handleTokenRemove}
>
<IconButton>
<RemoveTokenIcon />
</IconButton>
</Box>
);
}
export default TokenDragOverlay;