import { forwardRef } from 'react' import Block from '../Primitives/Block/Block' import Text from '../Text/Text' import { useResponsiveTokens } from '../../hooks/useResponsiveTokens' import { TimelineTokensType } from './timeline.token' import { TimelineNodeStatus } from './types' import type { TimelineSubstepProps } from './types' const CONNECTOR_PATH = 'M0.5 0.5V1.5C0.5 7.02285 4.97715 11.5 10.5 11.5H21.5' const TimelineSubstep = forwardRef( ( { title, description, timestamp, rightSlot, datetimeLeftSlot, datetimeRightSlot, isNestedUnderHeader = false, showIndicator = true, ...rest }, ref ) => { const tokens = useResponsiveTokens('TIMELINE') const { subsection, track, indicator } = tokens const { connector } = subsection const showDot = !isNestedUnderHeader && showIndicator const dotColor = tokens.statusColors[TimelineNodeStatus.NEUTRAL] const hasTitleRow = (title != null && title !== '') || rightSlot != null || datetimeLeftSlot != null || (timestamp != null && timestamp !== '') || datetimeRightSlot != null return ( {showDot && ( )} {hasTitleRow && ( {title} {rightSlot != null && ( {rightSlot} )} {datetimeLeftSlot != null && ( {datetimeLeftSlot} )} {timestamp != null && timestamp !== '' && ( {timestamp} )} {datetimeRightSlot != null && ( {datetimeRightSlot} )} )} {description != null && description !== '' && ( {description} )} ) } ) TimelineSubstep.displayName = 'Timeline.Substep' export default TimelineSubstep