Skip to content

Commit 7bab14b

Browse files
committed
cleanup Stage story
1 parent df11100 commit 7bab14b

File tree

2 files changed

+26
-34
lines changed

2 files changed

+26
-34
lines changed

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

+3-4
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,10 @@ const styles = {
2424

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

31-
const Stage = ({ stage, onContinue, complete }: Props) => {
30+
const Stage = ({ stage, onContinue }: Props) => {
3231
if (!stage.steps) {
3332
throw new Error('No Stage steps found')
3433
}
@@ -50,7 +49,7 @@ const Stage = ({ stage, onContinue, complete }: Props) => {
5049
if (!step) {
5150
return null
5251
}
53-
const hide = status === 'INCOMPLETE'
52+
const hide = 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
<div style={styles.options}>
6766
<Button onClick={onContinue}>Continue</Button>
6867
</div>

web-app/stories/Stage.stories.tsx

+23-30
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import React from '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-
import demo from './data/basic'
76
import SideBarDecorator from './utils/SideBarDecorator'
87

98
import Stage from '../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)