import React, { HTMLAttributes } from 'react'; import { Interval } from '../interval'; export type GetProgress = (now: number) => number; export interface StepItem { active: boolean; progress: number | GetProgress; title: string; isLong: boolean; } interface Props extends HTMLAttributes { steps: StepItem[]; } const checkMark = () => { return ( ); }; export const StepsProgress: React.FC = props => { const { steps, ...restProps } = props; return (
{steps.map((item, index) => { const { progress } = item; const getProgress = progress instanceof Function ? progress : (now: number) => progress; return (
{now => ( <>
= 100 ? "active": ""}`}> {item.title}
= 100 ? "long_step":""}`}>{checkMark()}
)}
); })}
); };