|
| 1 | +import { Button } from '@alifd/next' |
1 | 2 | import * as React from 'react' |
2 | | -import { Button, Card } from '@alifd/next' |
3 | 3 | import CR from 'typings' |
4 | 4 |
|
| 5 | +import Divider from '../Divider' |
5 | 6 | import Markdown from '../Markdown' |
| 7 | +import LevelStageSummary from './LevelStageSummary' |
6 | 8 |
|
7 | 9 | const styles = { |
8 | | - card: { |
9 | | - // width: '20rem', |
| 10 | + card: {}, |
| 11 | + content: { |
| 12 | + padding: '0rem 1rem', |
| 13 | + paddingBottom: '1rem', |
10 | 14 | }, |
11 | | - disabled: { |
12 | | - backgroundColor: 'grey', |
| 15 | + list: { |
| 16 | + padding: '0rem', |
13 | 17 | }, |
| 18 | + options: { |
| 19 | + padding: '0rem 1rem', |
| 20 | + }, |
| 21 | + title: {}, |
14 | 22 | } |
15 | 23 |
|
16 | 24 | interface Props { |
17 | 25 | level: CR.TutorialLevel |
18 | | - onNext(): void |
19 | | - onBack(): void |
20 | 26 | stages: { |
21 | 27 | [stageId: string]: any // CC.StageWithStatus |
22 | 28 | } |
| 29 | + onNext(): void |
| 30 | + onBack(): void |
23 | 31 | } |
24 | 32 |
|
25 | 33 | const Level = ({ level, stages, onNext, onBack }: Props) => { |
26 | 34 | const { title, text } = level.content |
27 | 35 | return ( |
28 | | - <Card style={styles.card} title={title} showTitleBullet={false} contentHeight="auto"> |
29 | | - <Markdown>{text}</Markdown> |
30 | | - <div> |
| 36 | + <div style={styles.card}> |
| 37 | + <div style={styles.content}> |
| 38 | + <h2 style={styles.title}>{title}</h2> |
| 39 | + <Markdown>{text}</Markdown> |
| 40 | + </div> |
| 41 | + <Divider /> |
| 42 | + <div style={styles.list}> |
31 | 43 | {level.stageList.map((stageId: string) => { |
32 | 44 | const stage = stages[stageId] |
33 | | - const unavailable = !stage.status.complete && !stage.status.active |
34 | | - return ( |
35 | | - <div key={stageId} style={unavailable ? styles.disabled : {}}> |
36 | | - <h3>{stage.content.title}</h3> |
37 | | - <p>{stage.content.text}</p> |
38 | | - {stage.status.active && <Button onClick={onNext}>Continue</Button>} |
39 | | - {stage.status.complete && <div>Complete</div>} |
40 | | - </div> |
41 | | - ) |
| 45 | + return <LevelStageSummary key={stageId} stage={stage} onNext={onNext} /> |
42 | 46 | })} |
43 | 47 | </div> |
44 | | - <Button onClick={onBack}>Back</Button> |
45 | | - </Card> |
| 48 | + <div style={styles.options}> |
| 49 | + <Button onClick={onBack}>Back</Button> |
| 50 | + </div> |
| 51 | + </div> |
46 | 52 | ) |
47 | 53 | } |
48 | 54 |
|
|
0 commit comments