@@ -12,21 +12,19 @@ export type TTimelineEvent = {
1212 end : number ;
1313 tooltip : string ;
1414 color : string ;
15+ backgroundColor : string ;
1516 body : React . ReactNode ;
1617 minWidthPerc ?: number ;
1718 isError ?: boolean ;
1819 markers ?: TTimelineSpanEventMarker [ ] ;
1920} ;
2021
2122type TimelineChartRowProps = {
22- events : TTimelineEvent [ ] | undefined ;
23+ events : TTimelineEvent [ ] ;
2324 maxVal : number ;
2425 height : number ;
2526 scale : number ;
2627 offset : number ;
27- eventStyles ?:
28- | React . CSSProperties
29- | ( ( event : TTimelineEvent ) => React . CSSProperties ) ;
3028 onEventHover ?: ( eventId : string ) => void ;
3129 onEventClick ?: ( event : TTimelineEvent ) => void ;
3230} ;
@@ -35,7 +33,6 @@ export const TimelineChartRowEvents = memo(function ({
3533 events,
3634 maxVal,
3735 height,
38- eventStyles,
3936 onEventHover,
4037 scale,
4138 offset,
@@ -48,7 +45,7 @@ export const TimelineChartRowEvents = memo(function ({
4845 < div
4946 style = { { marginRight : `${ ( - 1 * offset * scale ) . toFixed ( 6 ) } %` } }
5047 > </ div >
51- { ( events ?? [ ] ) . map ( ( e : TTimelineEvent , i , arr ) => {
48+ { events . map ( ( e : TTimelineEvent , i , arr ) => {
5249 const minWidth = ( e . minWidthPerc ?? 0 ) / 100 ;
5350 const lastEvent = arr [ i - 1 ] ;
5451 const lastEventMinEnd =
@@ -79,14 +76,14 @@ export const TimelineChartRowEvents = memo(function ({
7976 className = "d-flex align-items-center h-100 cursor-pointer text-truncate hover-opacity"
8077 style = { {
8178 userSelect : 'none' ,
82- backgroundColor : e . color ,
8379 minWidth : `${ percWidth . toFixed ( 6 ) } %` ,
8480 width : `${ percWidth . toFixed ( 6 ) } %` ,
8581 marginLeft : `${ percMarginLeft . toFixed ( 6 ) } %` ,
8682 position : 'relative' ,
87- ...( typeof eventStyles === 'function'
88- ? eventStyles ( e )
89- : eventStyles ) ,
83+ borderRadius : 2 ,
84+ fontSize : height * 0.5 ,
85+ color : e . color ,
86+ backgroundColor : e . backgroundColor ,
9087 } }
9188 >
9289 < div style = { { margin : 'auto' } } className = "px-2" >
0 commit comments