Upgrades #54
@@ -5,7 +5,6 @@ import {
|
||||
getMonth,
|
||||
sub,
|
||||
getDate,
|
||||
isSameDay,
|
||||
isBefore,
|
||||
endOfDay
|
||||
} from "date-fns";
|
||||
@@ -94,9 +93,7 @@ const Day = ({
|
||||
w="100%"
|
||||
h="100%"
|
||||
_hover={{
|
||||
cursor: isBefore(date, endOfDay(currDate))
|
||||
? "pointer"
|
||||
: "default",
|
||||
cursor: isBefore(date, endOfDay(currDate)) ? "pointer" : "default",
|
||||
background: "gray.700",
|
||||
border: "1px solid #FFF",
|
||||
color: "whiteAlpha.900"
|
||||
@@ -135,9 +132,7 @@ const Day = ({
|
||||
justifyContent="flex-start"
|
||||
pt={2}
|
||||
_hover={{
|
||||
cursor: isBefore(date, endOfDay(currDate))
|
||||
? "pointer"
|
||||
: "default",
|
||||
cursor: isBefore(date, endOfDay(currDate)) ? "pointer" : "default",
|
||||
background: "gray.700",
|
||||
border: "1px solid #FFF"
|
||||
}}
|
||||
|
||||
@@ -7,7 +7,8 @@ import CalenderNav from "./CalenderNav";
|
||||
import Day from "./Day";
|
||||
|
||||
const Calender = (newDate?: UpdateCalendarProps): JSX.Element => {
|
||||
const { selectedDate, layout, updateDate, currDate, setCurrDate } = useContext(CalenderContext);
|
||||
const { selectedDate, layout, updateDate, currDate, setCurrDate } =
|
||||
useContext(CalenderContext);
|
||||
const { stickersMonth } = useContext(StickersContext);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -25,7 +26,7 @@ const Calender = (newDate?: UpdateCalendarProps): JSX.Element => {
|
||||
useEffect(() => {
|
||||
console.info("Check to update date.");
|
||||
if (!isSameDay(currDate, new Date())) {
|
||||
console.info("Updated date.")
|
||||
console.info("Updated date.");
|
||||
setCurrDate(new Date());
|
||||
}
|
||||
}, [currDate, setCurrDate]);
|
||||
|
||||
@@ -240,8 +240,8 @@ const CalenderContextProvider = ({
|
||||
}
|
||||
};
|
||||
|
||||
// * Attempting to fix an issue with static generation where the date does not appear to be updating after initial generation.
|
||||
const [currDate, setCurrDate] = useState<Date>(new Date);
|
||||
// * Attempting to fix an issue with static generation where the date does not appear to be updating after initial generation.
|
||||
const [currDate, setCurrDate] = useState<Date>(new Date());
|
||||
|
||||
const calenderContextValues: CalenderContextState = {
|
||||
currDate,
|
||||
|
||||
Reference in New Issue
Block a user