@@ -3,6 +3,7 @@ import { Key, ReactElement, useEffect, useRef } from 'react';
33import { TimelineItem , TimelineItemRefs , TimelineItemsProps } from './TimelineItem' ;
44import { Positioning } from '../models/positioning' ;
55import { convertToCssVariable , StyleConfig } from '../models/style' ;
6+ import { isElement } from '../helper/element' ;
67
78export type TimelineProps = {
89 items : TimelineItemsProps ;
@@ -11,6 +12,7 @@ export type TimelineProps = {
1112 formatDate ?: ( date : Date ) => string ;
1213 customMarker ?: ReactElement ;
1314 customPointer ?: ReactElement ;
15+ customTimelineEnds ?: ReactElement | { opening ?: ReactElement ; closing ?: ReactElement } ;
1416 styleConfig ?: StyleConfig ;
1517 className ?: string ;
1618} ;
@@ -21,7 +23,7 @@ export const defaultTimelineConfig: Partial<TimelineProps> = {
2123} ;
2224
2325export 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 } = {
2527 ...defaultTimelineConfig ,
2628 ...props ,
2729 } ;
@@ -121,7 +123,14 @@ export function Timeline(props: TimelineProps) {
121123 ) ) }
122124 </ div >
123125
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 >
125134
126135 < div ref = { rightContainer } className = "timeline__items-container timeline__items-container--right" />
127136 </ div >
0 commit comments