@@ -25,7 +25,7 @@ type Props = {
25
25
draggedStickyNote : StickyNote | null ;
26
26
deleteStickyNote : ( id : string ) => void ;
27
27
setIsEventModalOpen : ( isOpen : boolean ) => void ;
28
- }
28
+ } ;
29
29
30
30
function getDaysInMonth ( date : Date ) {
31
31
const start = startOfWeek ( startOfMonth ( date ) , { weekStartsOn : 0 } ) ;
@@ -42,7 +42,11 @@ function getEventCountForDay(events: Event[], day: Date) {
42
42
. length ;
43
43
}
44
44
45
- function getTaskIndicatorStyle ( isDarkMode : boolean , todoCount : number , eventCount : number ) {
45
+ function getTaskIndicatorStyle (
46
+ isDarkMode : boolean ,
47
+ todoCount : number ,
48
+ eventCount : number ,
49
+ ) {
46
50
const count = todoCount + eventCount ;
47
51
if ( count === 0 ) return "" ;
48
52
const baseColor = isDarkMode ? "bg-red-" : "bg-red-" ;
@@ -52,13 +56,16 @@ function getTaskIndicatorStyle(isDarkMode: boolean, todoCount: number, eventCoun
52
56
}
53
57
54
58
export function CalendarRenderer ( {
55
- todos, events,
56
- currentMonth, selectedDate, handleDateSelect,
59
+ todos,
60
+ events,
61
+ currentMonth,
62
+ selectedDate,
63
+ handleDateSelect,
57
64
isDarkMode,
58
- draggedStickyNote, deleteStickyNote ,
59
- setIsEventModalOpen
60
- } : Props
61
- ) {
65
+ draggedStickyNote,
66
+ deleteStickyNote ,
67
+ setIsEventModalOpen ,
68
+ } : Props ) {
62
69
const days = getDaysInMonth ( currentMonth ) ;
63
70
const weeks = Math . ceil ( days . length / 7 ) ;
64
71
@@ -78,7 +85,8 @@ export function CalendarRenderer({
78
85
const weekDays = days . slice ( weekIndex * 7 , ( weekIndex + 1 ) * 7 ) ;
79
86
const maxEventsInWeek = Math . max (
80
87
...weekDays . map (
81
- ( day ) => getTodoCountForDay ( todos , day ) + getEventCountForDay ( events , day ) ,
88
+ ( day ) =>
89
+ getTodoCountForDay ( todos , day ) + getEventCountForDay ( events , day ) ,
82
90
) ,
83
91
) ;
84
92
const weekHeight =
@@ -105,10 +113,11 @@ export function CalendarRenderer({
105
113
return (
106
114
< motion . div
107
115
key = { day . toISOString ( ) }
108
- className = { `p-1 border rounded-md cursor-pointer transition-all duration-300 overflow-hidden ${ isSelected ? "border-blue-300 dark:border-blue-600" : "" } ${ ! isCurrentMonth
109
- ? "text-gray-400 dark:text-gray-600 bg-gray-100 dark:bg-gray-700"
110
- : ""
111
- } ${ getTaskIndicatorStyle ( isDarkMode , todoCount , eventCount ) } hover:bg-gray-100 dark:hover:bg-gray-700`}
116
+ className = { `p-1 border rounded-md cursor-pointer transition-all duration-300 overflow-hidden ${ isSelected ? "border-blue-300 dark:border-blue-600" : "" } ${
117
+ ! isCurrentMonth
118
+ ? "text-gray-400 dark:text-gray-600 bg-gray-100 dark:bg-gray-700"
119
+ : ""
120
+ } ${ getTaskIndicatorStyle ( isDarkMode , todoCount , eventCount ) } hover:bg-gray-100 dark:hover:bg-gray-700`}
112
121
onClick = { ( ) => handleDateSelect ( day ) }
113
122
whileHover = { { scale : 1.05 } }
114
123
whileTap = { { scale : 0.95 } }
@@ -164,4 +173,4 @@ export function CalendarRenderer({
164
173
} ) }
165
174
</ div >
166
175
) ;
167
- } ;
176
+ }
0 commit comments