import React from 'react'; import { Tooltip } from 'antd'; import './index.less'; function Step(props) { const { list = [], step = 1, onClick, message, maxStep } = props; return ( <div className="step"> {list.map((item, index) => { const info = <div className={`item ${index === step - 1 ? 'active' : ''}`} onClick={() => { if ((maxStep && index < maxStep) || !maxStep) onClick(index + 1); }}> <span className="text">{item}</span> </div>; if ((maxStep && index < maxStep) || !maxStep) { return info; } return <Tooltip title={message}> {info} </Tooltip>; })} </div> ); } Step.propTypes = {}; export default Step;