@@ -7,16 +7,20 @@ import { Repeat } from 'lucide-react';
7
7
import { useAdapter } from '@mui/x-scheduler-headless/use-adapter' ;
8
8
import { selectors } from '@mui/x-scheduler-headless/use-event-calendar' ;
9
9
import { useEventCalendarStoreContext } from '@mui/x-scheduler-headless/use-event-calendar-store-context' ;
10
- import { AgendaEventProps } from './AgendaEvent .types' ;
10
+ import { EventItemProps } from './EventItem .types' ;
11
11
import { getColorClassName } from '../../../utils/color-utils' ;
12
12
import { useTranslations } from '../../../utils/TranslationsContext' ;
13
- import './AgendaEvent .css' ;
13
+ import './EventItem .css' ;
14
14
// TODO: Create a standalone component for the resource color pin instead of re-using another component's CSS classes
15
15
import '../../resource-legend/ResourceLegend.css' ;
16
16
import '../index.css' ;
17
17
18
- export const AgendaEvent = React . forwardRef ( function AgendaEvent (
19
- props : AgendaEventProps ,
18
+ /**
19
+ * Component used to display an event occurrence, without any positioning capabilities
20
+ * Used in <AgendaView /> and in the event popover of <MonthView /> to display the list of events for a specific day.
21
+ */
22
+ export const EventItem = React . forwardRef ( function EventItem (
23
+ props : EventItemProps ,
20
24
forwardedRef : React . ForwardedRef < HTMLDivElement > ,
21
25
) {
22
26
const {
@@ -54,16 +58,16 @@ export const AgendaEvent = React.forwardRef(function AgendaEvent(
54
58
}
55
59
/>
56
60
< p
57
- className = { clsx ( 'AgendaEventCardContent ' , 'LinesClamp' ) }
61
+ className = { clsx ( 'EventItemCardContent ' , 'LinesClamp' ) }
58
62
style = { { '--number-of-lines' : 1 } as React . CSSProperties }
59
63
>
60
- < time className = "AgendaEventTime AgendaEventTime --compact" >
64
+ < time className = "EventItemTime EventItemTime --compact" >
61
65
< span >
62
66
{ adapter . format ( occurrence . start , ampm ? 'hoursMinutes12h' : 'hoursMinutes24h' ) }
63
67
</ span >
64
68
</ time >
65
69
66
- < span className = "AgendaEventTitle " > { occurrence . title } </ span >
70
+ < span className = "EventItemTitle " > { occurrence . title } </ span >
67
71
</ p >
68
72
{ isRecurring && (
69
73
< Repeat
@@ -80,7 +84,7 @@ export const AgendaEvent = React.forwardRef(function AgendaEvent(
80
84
return (
81
85
< React . Fragment >
82
86
< p
83
- className = { clsx ( 'AgendaEventTitle ' , 'LinesClamp' ) }
87
+ className = { clsx ( 'EventItemTitle ' , 'LinesClamp' ) }
84
88
style = { { '--number-of-lines' : 1 } as React . CSSProperties }
85
89
>
86
90
{ occurrence . title }
@@ -98,7 +102,7 @@ export const AgendaEvent = React.forwardRef(function AgendaEvent(
98
102
case 'regular' :
99
103
default :
100
104
return (
101
- < div className = "AgendaEventCardWrapper " >
105
+ < div className = "EventItemCardWrapper " >
102
106
< span
103
107
className = "ResourceLegendColor"
104
108
role = "img"
@@ -109,13 +113,13 @@ export const AgendaEvent = React.forwardRef(function AgendaEvent(
109
113
}
110
114
/>
111
115
< p
112
- className = { clsx ( 'AgendaEventCardContent ' , 'LinesClamp' ) }
116
+ className = { clsx ( 'EventItemCardContent ' , 'LinesClamp' ) }
113
117
style = { { '--number-of-lines' : 1 } as React . CSSProperties }
114
118
>
115
119
{ occurrence ?. allDay ? (
116
- < span className = "AgendaEventTime " > { translations . allDay } </ span >
120
+ < span className = "EventItemTime " > { translations . allDay } </ span >
117
121
) : (
118
- < time className = "AgendaEventTime " >
122
+ < time className = "EventItemTime " >
119
123
< span >
120
124
{ adapter . format ( occurrence . start , ampm ? 'hoursMinutes12h' : 'hoursMinutes24h' ) }
121
125
</ span >
@@ -126,7 +130,7 @@ export const AgendaEvent = React.forwardRef(function AgendaEvent(
126
130
</ time >
127
131
) }
128
132
129
- < span className = "AgendaEventTitle " > { occurrence . title } </ span >
133
+ < span className = "EventItemTitle " > { occurrence . title } </ span >
130
134
</ p >
131
135
{ isRecurring && (
132
136
< Repeat
@@ -161,14 +165,14 @@ export const AgendaEvent = React.forwardRef(function AgendaEvent(
161
165
className ,
162
166
'EventContainer' ,
163
167
'EventCard' ,
164
- 'AgendaEventCard ' ,
165
- `AgendaEventCard --${ variant } ` ,
168
+ 'EventItemCard ' ,
169
+ `EventItemCard --${ variant } ` ,
166
170
getColorClassName ( color ) ,
167
171
) }
168
172
aria-labelledby = { `${ ariaLabelledBy } ${ id } ` }
169
173
{ ...other }
170
174
>
171
- < div className = { clsx ( 'AgendaEventCardWrapper ' , `AgendaEventCardWrapper --${ variant } ` ) } >
175
+ < div className = { clsx ( 'EventItemCardWrapper ' , `EventItemCardWrapper --${ variant } ` ) } >
172
176
{ content }
173
177
</ div >
174
178
</ div >
0 commit comments