diff --git a/src/components/dice/DiceButtons.js b/src/components/dice/DiceButtons.js index 235d2c2..2820aae 100644 --- a/src/components/dice/DiceButtons.js +++ b/src/components/dice/DiceButtons.js @@ -1,5 +1,6 @@ import React, { useState, useEffect } from "react"; -import { Flex, IconButton } from "theme-ui"; +import { Flex, IconButton, Box } from "theme-ui"; +import SimpleBar from "simplebar-react"; import D20Icon from "../../icons/D20Icon"; import D12Icon from "../../icons/D12Icon"; @@ -51,100 +52,123 @@ function DiceButtons({ setCurrentDice(dice); } + let buttons = [ + { + key: "d20", + title: "Add D20", + count: diceCounts.d20, + onClick: () => onDiceAdd(currentDice.class, "d20"), + children: , + }, + { + key: "d12", + title: "Add D12", + count: diceCounts.d12, + onClick: () => onDiceAdd(currentDice.class, "d12"), + children: , + }, + { + key: "d10", + title: "Add D10", + count: diceCounts.d10, + onClick: () => onDiceAdd(currentDice.class, "d10"), + children: , + }, + { + key: "d8", + title: "Add D8", + count: diceCounts.d8, + onClick: () => onDiceAdd(currentDice.class, "d8"), + children: , + }, + { + key: "d6", + title: "Add D6", + count: diceCounts.d6, + onClick: () => onDiceAdd(currentDice.class, "d6"), + children: , + }, + { + key: "d4", + title: "Add D4", + count: diceCounts.d4, + onClick: () => onDiceAdd(currentDice.class, "d4"), + children: , + }, + { + key: "d100", + title: "Add D100", + count: diceCounts.d100, + onClick: () => onDiceAdd(currentDice.class, "d100"), + children: , + }, + ]; + return ( - - - - onDiceAdd(currentDice.class, "d20")} - > - - - onDiceAdd(currentDice.class, "d12")} - > - - - onDiceAdd(currentDice.class, "d10")} - > - - - onDiceAdd(currentDice.class, "d8")} - > - - - onDiceAdd(currentDice.class, "d6")} - > - - - onDiceAdd(currentDice.class, "d4")} - > - - - onDiceAdd(currentDice.class, "d100")} - > - - - - - onDiceTraySizeChange(diceTraySize === "single" ? "double" : "single") - } - > - - - - onShareDiceChange(!shareDice)} - > - {shareDice ? : } - - + + + + + {buttons.map((button) => ( + + ))} + + + onDiceTraySizeChange( + diceTraySize === "single" ? "double" : "single" + ) + } + > + + + + onShareDiceChange(!shareDice)} + > + {shareDice ? : } + + + + ); } diff --git a/src/components/dice/DiceTrayOverlay.js b/src/components/dice/DiceTrayOverlay.js index 684e421..fb409f0 100644 --- a/src/components/dice/DiceTrayOverlay.js +++ b/src/components/dice/DiceTrayOverlay.js @@ -297,11 +297,15 @@ function DiceTrayOverlay({ display: isOpen ? "block" : "none", position: "relative", overflow: "visible", - pointerEvents: "all", }} >