-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathSteps.tsx
46 lines (41 loc) · 973 Bytes
/
Steps.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import * as React from 'react'
import * as T from 'typings'
import Step from './Step'
import Hints from './Hints'
interface Props {
steps: T.StepUI[]
displayAll?: boolean
}
const styles = {
steps: {
padding: '1rem 1rem',
},
}
const Steps = (props: Props) => {
if (!props.steps.length) {
return null
}
return (
<div css={styles.steps}>
{/* @ts-ignore typings are different between UI & data */}
{props.steps.map((step: T.StepUI) => {
if (!step) {
return null
}
return (
<div key={step.id}>
<Step
key={step.id}
status={step.status}
displayAll={props.displayAll || false}
content={step.content}
subtasks={step.subtasks}
/>
{['ACTIVE', 'COMPLETE'].includes(step.status) && <Hints hints={step.hints || []} />}
</div>
)
})}
</div>
)
}
export default Steps