From a256cbd1e33e7166c2f4636bc2e7487ee7843004 Mon Sep 17 00:00:00 2001 From: Lucid Kobold <72232219+LucidKobold@users.noreply.github.com> Date: Mon, 11 Apr 2022 14:15:01 -0500 Subject: [PATCH] Moved the isToday check out of the day componenet. --- components/calender/Day.tsx | 10 ++++++---- components/calender/index.tsx | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/components/calender/Day.tsx b/components/calender/Day.tsx index 941c72c..62e9d5b 100644 --- a/components/calender/Day.tsx +++ b/components/calender/Day.tsx @@ -22,6 +22,7 @@ interface DayProps { date: Date; selectedDate: Date; currDate: Date; + isToday: boolean; } /** @@ -39,7 +40,8 @@ const Day = ({ sticker, date, selectedDate, - currDate + currDate, + isToday }: DayProps): JSX.Element => { const handleNav = (direction: "next" | "prev") => { if (direction === "next") { @@ -142,7 +144,7 @@ const Day = ({ > 10 ? "0px 6px 3px 6px" : "0px 9px 3px 9px" @@ -150,8 +152,8 @@ const Day = ({ } h="auto" w="auto" - border={isSameDay(currDate, date) ? "1px solid #0068ff" : "0px"} - borderRadius={isSameDay(currDate, date) ? "100px" : "0px"} + border={isToday ? "1px solid #0068ff" : "0px"} + borderRadius={isToday ? "100px" : "0px"} > {`${getDate(date)}`} diff --git a/components/calender/index.tsx b/components/calender/index.tsx index 3a4dc03..524a294 100644 --- a/components/calender/index.tsx +++ b/components/calender/index.tsx @@ -100,6 +100,7 @@ const Calender = (newDate?: UpdateCalendarProps): JSX.Element => { date={date} selectedDate={selectedDate} currDate={currDate} + isToday={isSameDay(currDate, date)} key={ id.length ? id