import type { ReactNode } from 'react'; import { Box, Flex, Heading, Text } from '@chakra-ui/react'; import Reveal from '@/components/Reveal/Reveal'; // Height and width of a marker, and so the height of the middle row const MARKER = '3.5rem'; type TimelineStep = { id: string; title: string; text: string; // A decorative icon, e.g. from ProcessIcons icon?: ReactNode; }; type ProcessTimelineProps = { steps: readonly TimelineStep[]; // The band colour: the markers use it to hide the line behind them tone?: 'paper' | 'alt'; 'data-testid'?: string; }; // The steps of a process as a timeline (FR-ST-04, BR-SP-20..26): vertical // with the text beside each marker below `lg`, horizontal from `lg` with // the texts alternating above and below the line. One ordered list in both // layouts, so the reading order is the order of the steps. The line, the // markers and the icons are decoration only. export default function ProcessTimeline({ steps, tone = 'paper', 'data-testid': testId, }: ProcessTimelineProps) { if (steps.length === 0) return null; const background = tone === 'alt' ? 'paper.alt' : 'paper'; return ( {steps.map((step, index) => { const first = index === 0; const last = index === steps.length - 1; const above = index % 2 === 0; return ( {/* The line down to the next marker (vertical layout); the next marker hides its end */} {!last && ( ); }