1- import { Button } from '@alifd/next'
1+ import { Button , Step } from '@alifd/next'
22import * as React from 'react'
33import CR from 'typings'
4-
5- import Divider from '../Divider'
4+ 3
65import Markdown from '../Markdown'
76import LevelStageSummary from './LevelStageSummary'
87
@@ -18,6 +17,9 @@ const styles = {
1817 options : {
1918 padding : '0rem 1rem' ,
2019 } ,
20+ steps : {
21+ padding : '1rem 0.5rem' ,
22+ } ,
2123 title : { } ,
2224}
2325
@@ -31,19 +33,30 @@ interface Props {
3133}
3234
3335const Level = ( { level, stages, onNext, onBack } : Props ) => {
34- const { title, text } = level . content
36+ const { content, stageList } = level
37+ const { title, text } = content
38+ const activeIndex = stageList . findIndex ( ( stageId : string ) => {
39+ return stages [ stageId ] . status . active
40+ } )
3541 return (
3642 < div style = { styles . card } >
3743 < div style = { styles . content } >
3844 < h2 style = { styles . title } > { title } </ h2 >
3945 < Markdown > { text } </ Markdown >
4046 </ div >
41- < Divider />
42- < div style = { styles . list } >
43- { level . stageList . map ( ( stageId : string ) => {
44- const stage = stages [ stageId ]
45- return < LevelStageSummary key = { stageId } stage = { stage } onNext = { onNext } />
46- } ) }
47+ < div style = { styles . steps } >
48+ < Step current = { activeIndex } direction = "ver" animation = { false } >
49+ { stageList . map ( ( stageId : string , index : number ) => {
50+ const stage = stages [ stageId ]
51+ return (
52+ < Step . Item
53+ key = { stageId }
54+ title = { stage . content . title || `Stage ${ index + 1 } ` }
55+ content = { < LevelStageSummary key = { stageId } stage = { stage } onNext = { onNext } /> }
56+ />
57+ )
58+ } ) }
59+ </ Step >
4760 </ div >
4861 < div style = { styles . options } >
4962 < Button onClick = { onBack } > Back</ Button >
0 commit comments