diff --git a/src/components/dice/DiceTile.js b/src/components/dice/DiceTile.js index 39f0d9d..70991d5 100644 --- a/src/components/dice/DiceTile.js +++ b/src/components/dice/DiceTile.js @@ -1,28 +1,33 @@ import React from "react"; -import { Flex, Image, Text } from "theme-ui"; +import { Flex, Image, Text, Box } from "theme-ui"; -function DiceTile({ dice, isSelected, onDiceSelect, onDone }) { +function DiceTile({ dice, isSelected, onDiceSelect, onDone, large }) { return ( onDiceSelect(dice)} sx={{ - borderColor: "primary", - borderStyle: isSelected ? "solid" : "none", - borderWidth: "4px", position: "relative", - width: "150px", - height: "150px", + width: large ? "49%" : "32%", + height: "0", + paddingTop: large ? "49%" : "32%", borderRadius: "4px", justifyContent: "center", alignItems: "center", cursor: "pointer", }} - m={2} + my={1} bg="muted" onDoubleClick={() => onDone(dice)} > + ); } diff --git a/src/components/dice/DiceTiles.js b/src/components/dice/DiceTiles.js index 0965cd6..4a6f8b1 100644 --- a/src/components/dice/DiceTiles.js +++ b/src/components/dice/DiceTiles.js @@ -1,19 +1,22 @@ import React from "react"; import { Flex } from "theme-ui"; import SimpleBar from "simplebar-react"; +import { useMedia } from "react-media"; import DiceTile from "./DiceTile"; function DiceTiles({ dice, onDiceSelect, selectedDice, onDone }) { + const isSmallScreen = useMedia({ query: "(max-width: 500px)" }); + return ( - + {dice.map((dice) => ( @@ -23,6 +26,7 @@ function DiceTiles({ dice, onDiceSelect, selectedDice, onDone }) { isSelected={selectedDice && dice.key === selectedDice.key} onDiceSelect={onDiceSelect} onDone={onDone} + large={isSmallScreen} /> ))} diff --git a/src/modals/SelectDiceModal.js b/src/modals/SelectDiceModal.js index 7a3e967..3f42bda 100644 --- a/src/modals/SelectDiceModal.js +++ b/src/modals/SelectDiceModal.js @@ -9,7 +9,11 @@ import { dice } from "../dice"; function SelectDiceModal({ isOpen, onRequestClose, onDone, defaultDice }) { const [selectedDice, setSelectedDice] = useState(defaultDice); return ( - +