Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit21e903d

Browse files
committed
level stage steps
1 parentd12b7dd commit21e903d

File tree

2 files changed

+28
-35
lines changed

2 files changed

+28
-35
lines changed

‎web-app/src/components/Level/LevelStageSummary.tsx

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,11 @@ import CC from '../../../../typings/context'
55
importMarkdownfrom'../Markdown'
66

77
conststyles={
8-
active:{
9-
backgroundColor:'#e6f7ff',
10-
},
118
card:{
12-
padding:'0.5rem 1rem',
13-
},
14-
completed:{
15-
backgroundColor:'#f6ffed',
16-
},
17-
disabled:{
18-
// backgroundColor: 'blue',
9+
// padding: '0.5rem 1rem',
10+
marginRight:'1.5rem',
1911
},
2012
options:{},
21-
title:{
22-
margin:0,
23-
},
2413
}
2514

2615
interfaceProps{
@@ -30,20 +19,11 @@ interface Props {
3019

3120
constLevelStageSummary=(props:Props)=>{
3221
const{ stage, onNext}=props
33-
const{ complete, active}=stage.status
34-
constcardStyle={
35-
...styles.card,
36-
...(active ?styles.active :styles.disabled),
37-
...(complete ?styles.completed :{}),
38-
}
22+
const{ active}=stage.status
3923
return(
40-
<divstyle={cardStyle}>
41-
<h3style={styles.title}>{stage.content.title}</h3>
24+
<divstyle={styles.card}>
4225
<Markdown>{stage.content.text}</Markdown>
43-
<divstyle={styles.options}>
44-
{active&&<ButtononClick={onNext}>Continue</Button>}
45-
{complete&&<div>Complete</div>}
46-
</div>
26+
<divstyle={styles.options}>{active&&<ButtononClick={onNext}>Continue</Button>}</div>
4727
</div>
4828
)
4929
}

‎web-app/src/components/Level/index.tsx

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import{Button}from'@alifd/next'
1+
import{Button,Step}from'@alifd/next'
22
import*asReactfrom'react'
33
importCRfrom'typings'
4-
5-
importDividerfrom'../Divider'
4+
3
65
importMarkdownfrom'../Markdown'
76
importLevelStageSummaryfrom'./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

3335
constLevel=({ level, stages, onNext, onBack}:Props)=>{
34-
const{ title, text}=level.content
36+
const{ content, stageList}=level
37+
const{ title, text}=content
38+
constactiveIndex=stageList.findIndex((stageId:string)=>{
39+
returnstages[stageId].status.active
40+
})
3541
return(
3642
<divstyle={styles.card}>
3743
<divstyle={styles.content}>
3844
<h2style={styles.title}>{title}</h2>
3945
<Markdown>{text}</Markdown>
4046
</div>
41-
<Divider/>
42-
<divstyle={styles.list}>
43-
{level.stageList.map((stageId:string)=>{
44-
conststage=stages[stageId]
45-
return<LevelStageSummarykey={stageId}stage={stage}onNext={onNext}/>
46-
})}
47+
<divstyle={styles.steps}>
48+
<Stepcurrent={activeIndex}direction="ver"animation={false}>
49+
{stageList.map((stageId:string,index:number)=>{
50+
conststage=stages[stageId]
51+
return(
52+
<Step.Item
53+
key={stageId}
54+
title={stage.content.title||`Stage${index+1}`}
55+
content={<LevelStageSummarykey={stageId}stage={stage}onNext={onNext}/>}
56+
/>
57+
)
58+
})}
59+
</Step>
4760
</div>
4861
<divstyle={styles.options}>
4962
<ButtononClick={onBack}>Back</Button>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp