From 0012428159af2bf9d5fa53f1e2762e524cf68cb4 Mon Sep 17 00:00:00 2001 From: Mitchell McCaffrey Date: Fri, 7 Aug 2020 09:58:51 +1000 Subject: [PATCH] Cleaned up dice controls and moved to percentage for dice result margins --- src/components/dice/DiceButtons.js | 3 ++ src/components/dice/DiceControls.js | 65 -------------------------- src/components/dice/DiceResults.js | 15 ++++-- src/components/dice/DiceTrayOverlay.js | 31 +++++++----- 4 files changed, 33 insertions(+), 81 deletions(-) delete mode 100644 src/components/dice/DiceControls.js diff --git a/src/components/dice/DiceButtons.js b/src/components/dice/DiceButtons.js index 6e1fe8d..235d2c2 100644 --- a/src/components/dice/DiceButtons.js +++ b/src/components/dice/DiceButtons.js @@ -58,6 +58,9 @@ function DiceButtons({ alignItems: "center", flexDirection: "column", borderRadius: "4px", + position: "absolute", + top: "0", + left: "0", }} p={2} bg="overlay" diff --git a/src/components/dice/DiceControls.js b/src/components/dice/DiceControls.js deleted file mode 100644 index 9e002a4..0000000 --- a/src/components/dice/DiceControls.js +++ /dev/null @@ -1,65 +0,0 @@ -import React from "react"; - -import DiceButtons from "./DiceButtons"; -import DiceResults from "./DiceResults"; - -function DiceControls({ - onDiceAdd, - onDiceClear, - onDiceReroll, - onDiceLoad, - diceTraySize, - onDiceTraySizeChange, - shareDice, - onShareDiceChage, - diceRolls, - onDiceRollsChange, -}) { - return ( - <> -
- { - onDiceClear(); - onDiceRollsChange([]); - }} - onDiceReroll={onDiceReroll} - /> -
-
- { - onDiceAdd(style, type); - onDiceRollsChange([...diceRolls, { type, roll: "unknown" }]); - }} - onDiceLoad={onDiceLoad} - onDiceTraySizeChange={onDiceTraySizeChange} - diceTraySize={diceTraySize} - shareDice={shareDice} - onShareDiceChange={onShareDiceChage} - /> -
- - ); -} - -export default DiceControls; diff --git a/src/components/dice/DiceResults.js b/src/components/dice/DiceResults.js index 0bac0e2..c0f1965 100644 --- a/src/components/dice/DiceResults.js +++ b/src/components/dice/DiceResults.js @@ -34,13 +34,19 @@ function DiceResults({ diceRolls, onDiceClear, onDiceReroll }) { return ( {getDiceRollTotal(diceRolls)} @@ -79,11 +84,11 @@ function DiceResults({ diceRolls, onDiceClear, onDiceReroll }) { )} ) : ( - {rolls} + {rolls} )} + { + handleDiceClear(); + onDiceRollsChange([]); + }} + onDiceReroll={handleDiceReroll} + /> - { + handleDiceAdd(style, type); + onDiceRollsChange([...diceRolls, { type, roll: "unknown" }]); + }} + onDiceLoad={handleDiceLoad} + onDiceTraySizeChange={setDiceTraySize} + diceTraySize={diceTraySize} + shareDice={shareDice} + onShareDiceChange={onShareDiceChage} /> {isLoading && (