@@ -3,6 +3,7 @@ import { Key, ReactElement, useEffect, useRef } from 'react';
3
3
import { TimelineItem , TimelineItemRefs , TimelineItemsProps } from './TimelineItem' ;
4
4
import { Positioning } from '../models/positioning' ;
5
5
import { convertToCssVariable , StyleConfig } from '../models/style' ;
6
+ import { isElement } from '../helper/element' ;
6
7
7
8
export type TimelineProps = {
8
9
items : TimelineItemsProps ;
@@ -11,6 +12,7 @@ export type TimelineProps = {
11
12
formatDate ?: ( date : Date ) => string ;
12
13
customMarker ?: ReactElement ;
13
14
customPointer ?: ReactElement ;
15
+ customTimelineEnds ?: ReactElement | { opening ?: ReactElement ; closing ?: ReactElement } ;
14
16
styleConfig ?: StyleConfig ;
15
17
className ?: string ;
16
18
} ;
@@ -21,7 +23,7 @@ export const defaultTimelineConfig: Partial<TimelineProps> = {
21
23
} ;
22
24
23
25
export function Timeline ( props : TimelineProps ) {
24
- const { items, positioning, minMarkerGap, className, customMarker, customPointer, styleConfig, formatDate } = {
26
+ const { items, positioning, minMarkerGap, className, customMarker, customPointer, customTimelineEnds , styleConfig, formatDate } = {
25
27
...defaultTimelineConfig ,
26
28
...props ,
27
29
} ;
@@ -121,7 +123,14 @@ export function Timeline(props: TimelineProps) {
121
123
) ) }
122
124
</ div >
123
125
124
- < div className = "timeline__line" />
126
+ < div className = "timeline-line" >
127
+ < div className = "timeline-line__end timeline-line__end--opening" >
128
+ { isElement ( customTimelineEnds ) ? customTimelineEnds : customTimelineEnds ?. opening }
129
+ </ div >
130
+ < div className = "timeline-line__end timeline-line__end--closing" >
131
+ { isElement ( customTimelineEnds ) ? customTimelineEnds : customTimelineEnds ?. closing }
132
+ </ div >
133
+ </ div >
125
134
126
135
< div ref = { rightContainer } className = "timeline__items-container timeline__items-container--right" />
127
136
</ div >
0 commit comments