Modal step/page resets to 0 when re-opened.

This commit is contained in:
Lucid Kobold
2022-03-28 13:56:43 -05:00
parent 93de5cd16d
commit 5abad3a40a
2 changed files with 55 additions and 55 deletions

View File

@@ -58,11 +58,14 @@ const Day = ({
}
};
// This handles the modal for this date.
// This handles the modal for the day.
const [isOpen, setIsOpen] = useState<boolean>(false);
const [stickerState, setStickerState] = useState<StickerVal>(sticker);
// The step the modal is at.
const [step, setStep] = useState<number>(0);
/**
* TODO: Add logic to remove the onClick within overflow dates.
* Do not give dates for the next month an onClick.
@@ -114,7 +117,10 @@ const Day = ({
border="1px solid #0068ff"
w="100%"
h="100%"
onClick={() => setIsOpen(true)}
onClick={() => {
setStep(0);
setIsOpen(true);
}}
alignContent="center"
justifyContent="flex-start"
pt={2}
@@ -157,6 +163,8 @@ const Day = ({
updateIsOpen={setIsOpen}
updateSticker={setStickerState}
currSticker={stickerState}
step={step}
updateStep={setStep}
/>
)}
</StickersContextProvider>