Moved dice folder

This commit is contained in:
Mitchell McCaffrey
2020-05-28 13:06:33 +10:00
parent 1e0f767e73
commit b8e5554058
12 changed files with 22 additions and 22 deletions

View File

@@ -0,0 +1,42 @@
import React, { useState } from "react";
import { IconButton } from "theme-ui";
import SelectDiceIcon from "../../icons/SelectDiceIcon";
import SelectDiceModal from "../../modals/SelectDiceModal";
function SelectDiceButton({ onDiceChange, currentDice }) {
const [isModalOpen, setIsModalOpen] = useState(false);
function openModal() {
setIsModalOpen(true);
}
function closeModal() {
setIsModalOpen(false);
}
function handleDone(dice) {
onDiceChange(dice);
closeModal();
}
return (
<>
<IconButton
aria-label="Select Dice Style"
title="Select Dice Style"
color="hsl(210, 50%, 96%)"
onClick={openModal}
>
<SelectDiceIcon />
</IconButton>
<SelectDiceModal
isOpen={isModalOpen}
onRequestClose={closeModal}
defaultDice={currentDice}
onDone={handleDone}
/>
</>
);
}
export default SelectDiceButton;