Added keyboard shortcuts to map select

This commit is contained in:
Mitchell McCaffrey
2020-09-30 13:58:43 +10:00
parent b7a89a4a4a
commit 8ac4e0aec9
3 changed files with 49 additions and 18 deletions

View File

@@ -1,4 +1,4 @@
import React, { useState } from "react";
import React from "react";
import { Flex, Image as UIImage, IconButton, Box, Text } from "theme-ui";
import EditMapIcon from "../../icons/EditMapIcon";
@@ -15,7 +15,6 @@ function MapTile({
large,
canEdit,
}) {
const [isMapTileMenuOpen, setIsTileMenuOpen] = useState(false);
const isDefault = map.type === "default";
const mapSource = useDataSource(
isDefault
@@ -40,17 +39,17 @@ function MapTile({
alignItems: "center",
cursor: "pointer",
overflow: "hidden",
userSelect: "none",
}}
my={1}
mx={`${large ? 1 : 2 / 3}%`}
bg="muted"
onClick={(e) => {
e.stopPropagation();
setIsTileMenuOpen(false);
onMapSelect(map);
}}
onDoubleClick={(e) => {
if (!isMapTileMenuOpen) {
if (canEdit) {
onDone(e);
}
}}