2020-05-26 14:47:37 +10:00
|
|
|
import React, { useState } from "react";
|
|
|
|
|
import { Flex, Label, Button } from "theme-ui";
|
|
|
|
|
|
|
|
|
|
import Modal from "../components/Modal";
|
2020-05-28 13:06:33 +10:00
|
|
|
import DiceTiles from "../components/dice/DiceTiles";
|
2020-05-26 14:47:37 +10:00
|
|
|
|
|
|
|
|
import { dice } from "../dice";
|
|
|
|
|
|
|
|
|
|
function SelectDiceModal({ isOpen, onRequestClose, onDone, defaultDice }) {
|
|
|
|
|
const [selectedDice, setSelectedDice] = useState(defaultDice);
|
|
|
|
|
return (
|
|
|
|
|
<Modal isOpen={isOpen} onRequestClose={onRequestClose}>
|
|
|
|
|
<Flex
|
|
|
|
|
sx={{
|
|
|
|
|
flexDirection: "column",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Label pt={2} pb={1}>
|
|
|
|
|
Select a dice style
|
|
|
|
|
</Label>
|
|
|
|
|
<DiceTiles
|
|
|
|
|
dice={dice}
|
|
|
|
|
onDiceSelect={setSelectedDice}
|
|
|
|
|
selectedDice={selectedDice}
|
|
|
|
|
onDone={onDone}
|
|
|
|
|
/>
|
|
|
|
|
<Button my={2} variant="primary" onClick={() => onDone(selectedDice)}>
|
|
|
|
|
Done
|
|
|
|
|
</Button>
|
|
|
|
|
</Flex>
|
|
|
|
|
</Modal>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default SelectDiceModal;
|