2020-05-08 15:09:40 +10:00
|
|
|
import React, { useState } from "react";
|
|
|
|
|
import { Flex, IconButton } from "theme-ui";
|
2020-05-08 12:56:36 +10:00
|
|
|
|
2020-05-08 15:09:40 +10:00
|
|
|
import ExpandMoreDiceIcon from "../../icons/ExpandMoreDiceIcon";
|
2020-05-27 11:24:17 +10:00
|
|
|
import DiceTrayOverlay from "./dice/DiceTrayOverlay";
|
2020-05-08 12:56:36 +10:00
|
|
|
|
2020-05-27 14:47:51 +10:00
|
|
|
import { DiceLoadingProvider } from "../../contexts/DiceLoadingContext";
|
|
|
|
|
|
2020-05-08 12:56:36 +10:00
|
|
|
function MapDice() {
|
2020-05-14 22:51:06 +10:00
|
|
|
const [isExpanded, setIsExpanded] = useState(false);
|
2020-05-08 12:56:36 +10:00
|
|
|
|
|
|
|
|
return (
|
2020-05-08 15:09:40 +10:00
|
|
|
<Flex
|
2020-05-08 12:56:36 +10:00
|
|
|
sx={{
|
|
|
|
|
position: "absolute",
|
|
|
|
|
top: 0,
|
|
|
|
|
left: 0,
|
2020-05-25 20:37:17 +10:00
|
|
|
bottom: 0,
|
2020-05-08 15:09:40 +10:00
|
|
|
flexDirection: "column",
|
|
|
|
|
alignItems: "flex-start",
|
2020-05-08 12:56:36 +10:00
|
|
|
}}
|
2020-05-08 15:09:40 +10:00
|
|
|
ml={1}
|
2020-05-08 12:56:36 +10:00
|
|
|
>
|
2020-05-08 15:09:40 +10:00
|
|
|
<IconButton
|
|
|
|
|
aria-label={isExpanded ? "Hide Dice Tray" : "Show Dice Tray"}
|
|
|
|
|
title={isExpanded ? "Hide Dice Tray" : "Show Dice Tray"}
|
|
|
|
|
onClick={() => setIsExpanded(!isExpanded)}
|
|
|
|
|
sx={{
|
|
|
|
|
display: "block",
|
|
|
|
|
backgroundColor: "overlay",
|
|
|
|
|
borderRadius: "50%",
|
2020-05-08 12:56:36 +10:00
|
|
|
}}
|
2020-05-08 15:09:40 +10:00
|
|
|
m={2}
|
2020-05-08 12:56:36 +10:00
|
|
|
>
|
2020-05-26 15:43:46 +10:00
|
|
|
<ExpandMoreDiceIcon isExpanded={isExpanded} />
|
2020-05-08 15:09:40 +10:00
|
|
|
</IconButton>
|
2020-05-27 14:47:51 +10:00
|
|
|
<DiceLoadingProvider>
|
|
|
|
|
<DiceTrayOverlay isOpen={isExpanded} />
|
|
|
|
|
</DiceLoadingProvider>
|
2020-05-08 15:09:40 +10:00
|
|
|
</Flex>
|
2020-05-08 12:56:36 +10:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default MapDice;
|