11import { Button , Step } from '@alifd/next'
22import * as React from 'react'
33import CR from 'typings'
4- 3
4+ import CC from '../../../../typings/context'
5+
56import Markdown from '../Markdown'
67import LevelStageSummary from './LevelStageSummary'
78
@@ -38,6 +39,7 @@ const Level = ({ level, stages, onNext, onBack }: Props) => {
3839 const activeIndex = stageList . findIndex ( ( stageId : string ) => {
3940 return stages [ stageId ] . status . active
4041 } )
42+
4143 return (
4244 < div style = { styles . card } >
4345 < div style = { styles . content } >
@@ -47,12 +49,22 @@ const Level = ({ level, stages, onNext, onBack }: Props) => {
4749 < div style = { styles . steps } >
4850 < Step current = { activeIndex } direction = "ver" animation = { false } >
4951 { stageList . map ( ( stageId : string , index : number ) => {
50- const stage = stages [ stageId ]
52+ const stage : CC . StageWithStatus = stages [ stageId ]
53+ const { active } = stage . status
54+ const clickHandler = active ? onNext : ( ) => { }
55+ // note - must add click handler to title, content & step.item
56+ // as all are separted components
5157 return (
5258 < Step . Item
5359 key = { stageId }
54- title = { stage . content . title || `Stage ${ index + 1 } ` }
55- content = { < LevelStageSummary key = { stageId } stage = { stage } onNext = { onNext } /> }
60+ style = { { backgroundColor : 'blue' } }
61+ title = {
62+ < span className = { active ? 'hover-select' : '' } onClick = { clickHandler } >
63+ { stage . content . title || `Stage ${ index + 1 } ` }
64+ </ span >
65+ }
66+ content = { < LevelStageSummary key = { stageId } stage = { stage } onNext = { clickHandler } /> }
67+ onClick = { clickHandler }
5668 />
5769 )
5870 } ) }
0 commit comments