/* eslint-disable react/prop-types */
import PropTypes from 'prop-types'
import React from 'react'
import * as Styled from './styled'
export const StepsComponent = ({ current, status, titles }) => {
const steps = titles.map((title, i) => {
let stepStatus
if (i < current) {
stepStatus = 'finish'
} else if (i === current) {
stepStatus = status === 'finish' ? 'finish' : status
} else {
stepStatus = status === 'finish' ? 'finish' : 'wait'
}
return
})
return {steps}
}
const formatNumber = (n) => {
return n > 9 ? `${n}` : `0${n}`
}
const StepIcon = ({ status, children }) => {
let IconComponent
switch (status) {
case 'progress':
IconComponent = Styled.ProcessIcon
break
case 'wait':
IconComponent = Styled.WaitIcon
break
case 'error':
IconComponent = Styled.ErrorIcon
break
default:
IconComponent = Styled.DefaultIcon
}
return {children}
}
const Step = ({ stepNumber, title, status }) => {
return (
{formatNumber(stepNumber)}
{title}
)
}
Step.propTypes = {
title: PropTypes.string,
stepNumber: PropTypes.number,
status: PropTypes.oneOf(['wait', 'progress', 'finish', 'error'])
}
StepsComponent.propTypes = {
title: PropTypes.node,
size: PropTypes.string,
padding: PropTypes.string,
show: PropTypes.bool || PropTypes.number,
backdrop: PropTypes.bool,
keyboard: PropTypes.bool,
footer: PropTypes.bool,
btnCancel: PropTypes.bool,
btnConfirm: PropTypes.bool,
children: PropTypes.object,
hiddeOnConfirm: PropTypes.bool,
timeOut: PropTypes.number,
height: PropTypes.string,
header: PropTypes.bool,
submit: PropTypes.bool,
onHidde: PropTypes.func,
onCancel: PropTypes.func,
onConfirm: PropTypes.func,
hideOnConfirm: PropTypes.func,
closeIcon: PropTypes.bool,
borderRadius: PropTypes.string,
onHide: PropTypes.func
}