Dynamically render cursor and modal. Removed unused imports.
This commit is contained in:
@@ -1,5 +1,14 @@
|
|||||||
import { Box, Text, VStack } from "@chakra-ui/react";
|
import { Box, Text, VStack } from "@chakra-ui/react";
|
||||||
import { add, getYear, getMonth, sub, getDate, isSameDay, isBefore, endOfDay } from "date-fns";
|
import {
|
||||||
|
add,
|
||||||
|
getYear,
|
||||||
|
getMonth,
|
||||||
|
sub,
|
||||||
|
getDate,
|
||||||
|
isSameDay,
|
||||||
|
isBefore,
|
||||||
|
endOfDay
|
||||||
|
} from "date-fns";
|
||||||
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";
|
||||||
@@ -71,7 +80,9 @@ const Day = ({
|
|||||||
w="100%"
|
w="100%"
|
||||||
h="100%"
|
h="100%"
|
||||||
_hover={{
|
_hover={{
|
||||||
cursor: isBefore(date, endOfDay(new Date)) ? "pointer" : "default",
|
cursor: isBefore(date, endOfDay(new Date()))
|
||||||
|
? "pointer"
|
||||||
|
: "default",
|
||||||
background: "gray.700",
|
background: "gray.700",
|
||||||
border: "1px solid #FFF",
|
border: "1px solid #FFF",
|
||||||
color: "whiteAlpha.900"
|
color: "whiteAlpha.900"
|
||||||
@@ -107,7 +118,9 @@ const Day = ({
|
|||||||
justifyContent="flex-start"
|
justifyContent="flex-start"
|
||||||
pt={2}
|
pt={2}
|
||||||
_hover={{
|
_hover={{
|
||||||
cursor: isBefore(date, endOfDay(new Date)) ? "pointer" : "default",
|
cursor: isBefore(date, endOfDay(new Date()))
|
||||||
|
? "pointer"
|
||||||
|
: "default",
|
||||||
background: "gray.700",
|
background: "gray.700",
|
||||||
border: "1px solid #FFF"
|
border: "1px solid #FFF"
|
||||||
}}
|
}}
|
||||||
@@ -137,11 +150,13 @@ const Day = ({
|
|||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
<StickersContextProvider>
|
<StickersContextProvider>
|
||||||
{isBefore(date, endOfDay(new Date)) &&
|
{isBefore(date, endOfDay(new Date())) && (
|
||||||
(
|
<AddSticker
|
||||||
<AddSticker date={date} isOpen={isOpen} updateIsOpen={setIsOpen} />
|
date={date}
|
||||||
)
|
isOpen={isOpen}
|
||||||
}
|
updateIsOpen={setIsOpen}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</StickersContextProvider>
|
</StickersContextProvider>
|
||||||
</VStack>
|
</VStack>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user