import { JSXElement } from "solid-js"; import { useClassList } from "../utils/useProps"; import { Icon } from "../Icon"; export interface InnerStepProps { title?: JSXElement | string description?: JSXElement | string style?: any classList?: any class?: string icon?: JSXElement, status?: 'finished'|'process'|'error'|'warning'|'wait' current: number, index: number, } export function InnerStep (props: InnerStepProps) { let status = () : string => { if (props.status) { return props.status; } let ret:string = ''; if (props.current + 1 > props.index) { ret = 'finished'; } if (props.current + 1 === props.index) { ret = 'process'; } return ret || 'wait'; } let done = () : string => { let ret:string = ''; if (props.current + 1 > props.index) { ret = 'done'; } if (props.current + 1 === props.index) { ret = 'active'; } return ret; } const classList = () => useClassList(props, 'cm-steps-item', { [`cm-steps-status-${status()}`]: status(), [`cm-steps-status-${done()}`]: done(), }) const inner = () => { let ret:JSXElement = ''; if (!props.icon) { if (status() === 'finished') { ret =
; } else if (status() === 'error') { ret = ; } else if (status() === 'warning') { ret = ; } else { ret =
{props.index}
; } } else { ret = props.icon; } return ret; } return
{inner()}
{props.title}
{props.description}
; }