Moved the isToday check out of the day componenet.

This commit is contained in:
Lucid Kobold
2022-04-11 14:15:01 -05:00
parent f6115a928c
commit a256cbd1e3
2 changed files with 7 additions and 4 deletions

View File

@@ -22,6 +22,7 @@ interface DayProps {
date: Date; date: Date;
selectedDate: Date; selectedDate: Date;
currDate: Date; currDate: Date;
isToday: boolean;
} }
/** /**
@@ -39,7 +40,8 @@ const Day = ({
sticker, sticker,
date, date,
selectedDate, selectedDate,
currDate currDate,
isToday
}: DayProps): JSX.Element => { }: DayProps): JSX.Element => {
const handleNav = (direction: "next" | "prev") => { const handleNav = (direction: "next" | "prev") => {
if (direction === "next") { if (direction === "next") {
@@ -142,7 +144,7 @@ const Day = ({
> >
<Text <Text
p={ p={
isSameDay(currDate, date) isToday
? getDate(date) > 10 ? getDate(date) > 10
? "0px 6px 3px 6px" ? "0px 6px 3px 6px"
: "0px 9px 3px 9px" : "0px 9px 3px 9px"
@@ -150,8 +152,8 @@ const Day = ({
} }
h="auto" h="auto"
w="auto" w="auto"
border={isSameDay(currDate, date) ? "1px solid #0068ff" : "0px"} border={isToday ? "1px solid #0068ff" : "0px"}
borderRadius={isSameDay(currDate, date) ? "100px" : "0px"} borderRadius={isToday ? "100px" : "0px"}
> >
{`${getDate(date)}`} {`${getDate(date)}`}
</Text> </Text>

View File

@@ -100,6 +100,7 @@ const Calender = (newDate?: UpdateCalendarProps): JSX.Element => {
date={date} date={date}
selectedDate={selectedDate} selectedDate={selectedDate}
currDate={currDate} currDate={currDate}
isToday={isSameDay(currDate, date)}
key={ key={
id.length id.length
? id ? id