diff --git a/src/components/dice/DiceButton.js b/src/components/dice/DiceButton.js index a7f1f69..833d5c5 100644 --- a/src/components/dice/DiceButton.js +++ b/src/components/dice/DiceButton.js @@ -9,7 +9,6 @@ function DiceButton({ title, children, count, onClick }) { title={title} aria-label={title} onClick={onClick} - color="hsl(210, 50%, 96%)" sx={{ position: "relative" }} > {children} diff --git a/src/components/dice/DiceButtonCount.js b/src/components/dice/DiceButtonCount.js index b18caba..4b17aac 100644 --- a/src/components/dice/DiceButtonCount.js +++ b/src/components/dice/DiceButtonCount.js @@ -6,9 +6,9 @@ function DiceButtonCount({ children }) { - {children}× + {children} ); diff --git a/src/components/dice/DiceButtons.js b/src/components/dice/DiceButtons.js index c2900da..d314697 100644 --- a/src/components/dice/DiceButtons.js +++ b/src/components/dice/DiceButtons.js @@ -51,16 +51,18 @@ function DiceButtons({ - + - + { + function handleResize() { + const map = document.querySelector(".map"); + const mapRect = map.getBoundingClientRect(); + + const availableWidth = mapRect.width - 108; // Subtract padding + const availableHeight = mapRect.height - 80; // Subtract paddding and open icon + + let height = Math.min(availableHeight, 1000); + let width = diceTraySize === "single" ? height / 2 : height; + + if (width > availableWidth) { + width = availableWidth; + height = diceTraySize === "single" ? width * 2 : width; + } + + setTraySize({ width, height }); + } + + window.addEventListener("resize", handleResize); + + handleResize(); + + return () => { + window.removeEventListener("resize", handleResize); + }; + }, [diceTraySize]); + return ( - { - sceneInteractionRef.current = true; - }} - onPointerUp={() => { - sceneInteractionRef.current = false; - }} - /> + + { + sceneInteractionRef.current = true; + }} + onPointerUp={() => { + sceneInteractionRef.current = false; + }} + /> + - {isLoading && } + {isLoading && ( + + + + )} ); } diff --git a/src/components/dice/SelectDiceButton.js b/src/components/dice/SelectDiceButton.js index 933ccee..58e7f24 100644 --- a/src/components/dice/SelectDiceButton.js +++ b/src/components/dice/SelectDiceButton.js @@ -24,7 +24,6 @@ function SelectDiceButton({ onDiceChange, currentDice }) {