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

Commit7bab14b

Browse files
committed
cleanup Stage story
1 parentdf11100 commit7bab14b

File tree

2 files changed

+26
-34
lines changed

2 files changed

+26
-34
lines changed

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,10 @@ const styles = {
2424

2525
interfaceProps{
2626
stage:T.Stage
27-
complete:boolean
2827
onContinue():void
2928
}
3029

31-
constStage=({ stage, onContinue, complete}:Props)=>{
30+
constStage=({ stage, onContinue}:Props)=>{
3231
if(!stage.steps){
3332
thrownewError('No Stage steps found')
3433
}
@@ -50,7 +49,7 @@ const Stage = ({ stage, onContinue, complete }: Props) => {
5049
if(!step){
5150
returnnull
5251
}
53-
consthide=status==='INCOMPLETE'
52+
consthide=step.status==='INCOMPLETE'
5453
return(
5554
<Step.Item
5655
key={step.id}
@@ -62,7 +61,7 @@ const Stage = ({ stage, onContinue, complete }: Props) => {
6261
</Step>
6362
</div>
6463

65-
{complete&&(
64+
{stage.status==='COMPLETE'&&(
6665
<divstyle={styles.options}>
6766
<ButtononClick={onContinue}>Continue</Button>
6867
</div>

‎web-app/stories/Stage.stories.tsx

Lines changed: 23 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
importReactfrom'react'
22

33
import{action}from'@storybook/addon-actions'
4-
import{boolean,object,withKnobs}from'@storybook/addon-knobs'
4+
import{object,withKnobs}from'@storybook/addon-knobs'
55
import{storiesOf}from'@storybook/react'
6-
importdemofrom'./data/basic'
76
importSideBarDecoratorfrom'./utils/SideBarDecorator'
87

98
importStagefrom'../src/components/Stage'
@@ -13,44 +12,38 @@ storiesOf('Tutorial SideBar', module)
1312
.addDecorator(withKnobs)
1413
.add('Stage',()=>(
1514
<Stage
16-
steps={object('steps',{
17-
step1Id:{
18-
content:{
15+
stage={{
16+
id:'1',
17+
title:'Stage Title',
18+
text:'A description of the stage',
19+
steps:[
20+
{
21+
id:'1',
1922
title:'Sum',
2023
text:'Write a function `sum` that adds two numbers together',
24+
status:'COMPLETE',
2125
},
22-
hints:[],
23-
status:{
24-
active:false,
25-
complete:true,
26-
},
27-
},
28-
step2Id:{
29-
content:{
26+
{
27+
id:'2',
3028
title:'Multiply',
3129
text:`Write a function \`multiply\` that multiplies two numbers together
3230
33-
\`\`\`
34-
function someExample(a) {
35-
return a * 1
36-
}
37-
\`\`\`
38-
`,
31+
\`\`\`
32+
function someExample(a) {
33+
return a * 1
34+
}
35+
\`\`\`
36+
`,
37+
status:'ACTIVE',
3938
},
40-
hints:[],
41-
status:{active:true,complete:false},
42-
},
43-
step3Id:{
44-
content:{
39+
{
40+
id:'3',
4541
title:'Divide',
4642
text:'Write a function `divide` that divides',
43+
status:'INCOMPLETE',
4744
},
48-
hints:[],
49-
status:{active:false,complete:false},
50-
},
51-
})}
52-
stage={object('stage',demo.data.stages.stage1Id)}
53-
complete={boolean('complete',false)}
45+
],
46+
}}
5447
onContinue={action('onContinue')}
5548
/>
5649
))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp