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 (
|
2020-09-06 16:24:23 +10:00
|
|
|
<Modal
|
|
|
|
|
isOpen={isOpen}
|
|
|
|
|
onRequestClose={onRequestClose}
|
|
|
|
|
style={{ maxWidth: "542px", width: "calc(100% - 16px)" }}
|
|
|
|
|
>
|
2020-05-26 14:47:37 +10:00
|
|
|
<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)}>
|
2020-10-17 09:19:04 +11:00
|
|
|
Select
|
2020-05-26 14:47:37 +10:00
|
|
|
</Button>
|
|
|
|
|
</Flex>
|
|
|
|
|
</Modal>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default SelectDiceModal;
|