import type {IDotLine} from '../../../molecules/dot-line'; import type { TimelineGetVariantType, ITimelineStepItem, } from '../timeline-step.type'; const getActiveStatusIndex = ( steps: ITimelineStepItem[], status: T, ): number => steps.findIndex((step: ITimelineStepItem) => step.name == status); export const getVariantHof = ( steps: ITimelineStepItem[], status: T, ): TimelineGetVariantType => { const activeStatusIndex: number = getActiveStatusIndex(steps, status); return (index: number): IDotLine['variant'] => { switch (true) { case index > activeStatusIndex: return 'inactive'; case index == activeStatusIndex: return 'active'; default: return 'normal'; } }; };