Modals #44
@@ -12,7 +12,7 @@ import {
|
|||||||
import router from "next/router";
|
import router from "next/router";
|
||||||
import React, { Fragment, useState } from "react";
|
import React, { Fragment, useState } from "react";
|
||||||
import { StickersContextProvider } from "../../contexts/StickerContext";
|
import { StickersContextProvider } from "../../contexts/StickerContext";
|
||||||
import AddSticker from "./modals/AddSticker";
|
import AddUpdateSticker from "./modals/AddUpdateSticker";
|
||||||
import DemoStickers from "./stickers/DemoStickers";
|
import DemoStickers from "./stickers/DemoStickers";
|
||||||
|
|
||||||
interface DayProps {
|
interface DayProps {
|
||||||
@@ -163,7 +163,7 @@ const Day = ({
|
|||||||
</Box>
|
</Box>
|
||||||
<StickersContextProvider>
|
<StickersContextProvider>
|
||||||
{isBefore(date, endOfDay(new Date())) && (
|
{isBefore(date, endOfDay(new Date())) && (
|
||||||
<AddSticker
|
<AddUpdateSticker
|
||||||
date={date}
|
date={date}
|
||||||
isOpen={isOpen}
|
isOpen={isOpen}
|
||||||
updateIsOpen={setIsOpen}
|
updateIsOpen={setIsOpen}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ interface AddStickerProps {
|
|||||||
* @param {React.Dispatch<React.SetStateAction<number>>} updateStep Used to navigate the pages of the modal by updating the step the modal is on.
|
* @param {React.Dispatch<React.SetStateAction<number>>} updateStep Used to navigate the pages of the modal by updating the step the modal is on.
|
||||||
* @param {React.Dispatch<React.SetStateAction<StickerVal>>} updateSticker The react state function to update the selected sticker that will be added or updated.
|
* @param {React.Dispatch<React.SetStateAction<StickerVal>>} updateSticker The react state function to update the selected sticker that will be added or updated.
|
||||||
*/
|
*/
|
||||||
const AddSticker = ({
|
const AddUpdateSticker = ({
|
||||||
isOpen,
|
isOpen,
|
||||||
updateIsOpen,
|
updateIsOpen,
|
||||||
date,
|
date,
|
||||||
@@ -171,19 +171,19 @@ const AddSticker = ({
|
|||||||
<HStack
|
<HStack
|
||||||
w="100%"
|
w="100%"
|
||||||
h="auto"
|
h="auto"
|
||||||
justifyContent={"space-between"}
|
justifyContent="space-between"
|
||||||
alignContent={"center"}
|
alignContent="center"
|
||||||
>
|
>
|
||||||
<Button variant="primary" onClick={() => updateStep(step - 1)}>
|
<Button variant="primary" onClick={() => updateStep(step - 1)}>
|
||||||
{"Previous"}
|
{"Previous"}
|
||||||
</Button>
|
</Button>
|
||||||
<HStack w="auto" h="auto" alignContent={"center"} spacing={6}>
|
<HStack w="auto" h="auto" alignContent="center" spacing={6}>
|
||||||
<Button
|
<Button
|
||||||
variant="submit"
|
variant="submit"
|
||||||
isDisabled={
|
isDisabled={
|
||||||
selectedSticker === null || selectedSticker === currSticker
|
selectedSticker === null || selectedSticker === currSticker
|
||||||
}
|
}
|
||||||
onClick={() => handleSubmit(selectedSticker)}
|
onClick={() => handleSubmit(selectedSticker)}
|
||||||
>
|
>
|
||||||
{"Confirm"}
|
{"Confirm"}
|
||||||
</Button>
|
</Button>
|
||||||
@@ -216,13 +216,19 @@ const AddSticker = ({
|
|||||||
<HStack
|
<HStack
|
||||||
w="100%"
|
w="100%"
|
||||||
h="auto"
|
h="auto"
|
||||||
justifyContent={"space-between"}
|
justifyContent="space-between"
|
||||||
alignContent={"center"}
|
alignContent="center"
|
||||||
>
|
>
|
||||||
<Heading textAlign="center" as="h2" size="md" w="100%" h="auto">
|
<Heading textAlign="center" as="h2" size="md" w="100%" h="auto">
|
||||||
{modalVariant && variants[modalVariant][step].header}
|
{modalVariant && variants[modalVariant][step].header}
|
||||||
</Heading>
|
</Heading>
|
||||||
<Button onClick={() => updateIsOpen(!isOpen)}>{"X"}</Button>
|
<Button
|
||||||
|
fontSize="2rem"
|
||||||
|
px="1"
|
||||||
|
onClick={() => updateIsOpen(!isOpen)}
|
||||||
|
>
|
||||||
|
<Icon icon="bi:x" />
|
||||||
|
</Button>
|
||||||
</HStack>
|
</HStack>
|
||||||
</ModalHeader>
|
</ModalHeader>
|
||||||
<ModalBody>
|
<ModalBody>
|
||||||
@@ -236,4 +242,4 @@ const AddSticker = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default AddSticker;
|
export default AddUpdateSticker;
|
||||||
Reference in New Issue
Block a user