2020-04-18 23:31:40 +10:00
|
|
|
import React from "react";
|
|
|
|
|
import { Flex, Box, IconButton } from "theme-ui";
|
|
|
|
|
|
|
|
|
|
import AddMapButton from "./AddMapButton";
|
|
|
|
|
import ExpandMoreIcon from "../icons/ExpandMoreIcon";
|
|
|
|
|
import PanToolIcon from "../icons/PanToolIcon";
|
|
|
|
|
import BrushToolIcon from "../icons/BrushToolIcon";
|
|
|
|
|
import EraseToolIcon from "../icons/EraseToolIcon";
|
|
|
|
|
import UndoIcon from "../icons/UndoIcon";
|
|
|
|
|
import RedoIcon from "../icons/RedoIcon";
|
|
|
|
|
|
2020-04-19 00:24:06 +10:00
|
|
|
function MapControls({
|
|
|
|
|
onMapChange,
|
|
|
|
|
onToolChange,
|
|
|
|
|
selectedTool,
|
|
|
|
|
onUndo,
|
|
|
|
|
onRedo,
|
|
|
|
|
}) {
|
2020-04-18 23:31:40 +10:00
|
|
|
const divider = (
|
|
|
|
|
<Box
|
|
|
|
|
my={2}
|
|
|
|
|
bg="text"
|
|
|
|
|
sx={{ height: "2px", width: "24px", borderRadius: "2px", opacity: 0.5 }}
|
|
|
|
|
></Box>
|
|
|
|
|
);
|
|
|
|
|
return (
|
|
|
|
|
<Flex
|
|
|
|
|
p={2}
|
|
|
|
|
sx={{
|
|
|
|
|
position: "absolute",
|
|
|
|
|
top: 0,
|
|
|
|
|
right: 0,
|
|
|
|
|
flexDirection: "column",
|
|
|
|
|
alignItems: "center",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<IconButton aria-label="Expand More" title="Expand More">
|
|
|
|
|
<ExpandMoreIcon />
|
|
|
|
|
</IconButton>
|
|
|
|
|
<AddMapButton onMapChange={onMapChange} />
|
|
|
|
|
{divider}
|
2020-04-19 00:24:06 +10:00
|
|
|
<IconButton
|
|
|
|
|
aria-label="Pan Tool"
|
|
|
|
|
title="Pan Tool"
|
|
|
|
|
onClick={() => onToolChange("pan")}
|
|
|
|
|
sx={{ color: selectedTool === "pan" ? "primary" : "text" }}
|
|
|
|
|
>
|
2020-04-18 23:31:40 +10:00
|
|
|
<PanToolIcon />
|
|
|
|
|
</IconButton>
|
2020-04-19 00:24:06 +10:00
|
|
|
<IconButton
|
|
|
|
|
aria-label="Brush Tool"
|
|
|
|
|
title="Brush Tool"
|
|
|
|
|
onClick={() => onToolChange("brush")}
|
|
|
|
|
sx={{ color: selectedTool === "brush" ? "primary" : "text" }}
|
|
|
|
|
>
|
2020-04-18 23:31:40 +10:00
|
|
|
<BrushToolIcon />
|
|
|
|
|
</IconButton>
|
2020-04-19 00:24:06 +10:00
|
|
|
<IconButton
|
|
|
|
|
aria-label="Erase Tool"
|
|
|
|
|
title="Erase Tool"
|
|
|
|
|
onClick={() => onToolChange("erase")}
|
|
|
|
|
sx={{ color: selectedTool === "erase" ? "primary" : "text" }}
|
|
|
|
|
>
|
2020-04-18 23:31:40 +10:00
|
|
|
<EraseToolIcon />
|
|
|
|
|
</IconButton>
|
|
|
|
|
{divider}
|
|
|
|
|
<IconButton aria-label="Undo" title="Undo">
|
|
|
|
|
<UndoIcon />
|
|
|
|
|
</IconButton>
|
|
|
|
|
<IconButton aria-label="Redo" title="Redo">
|
|
|
|
|
<RedoIcon />
|
|
|
|
|
</IconButton>
|
|
|
|
|
</Flex>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default MapControls;
|