1
1
import * as React from 'react'
2
2
import * as T from 'typings'
3
+ import { Switch } from '@alifd/next'
3
4
import Steps from '../components/Steps'
4
5
import Content from '../components/Content'
5
6
@@ -15,7 +16,7 @@ const styles = {
15
16
header : {
16
17
display : 'flex' as 'flex' ,
17
18
alignItems : 'center' ,
18
- justifyContent : 'flex-start ' ,
19
+ justifyContent : 'space-between ' ,
19
20
height : '2rem' ,
20
21
backgroundColor : '#EBEBEB' ,
21
22
fontSize : '1rem' ,
@@ -25,22 +26,39 @@ const styles = {
25
26
title : {
26
27
marginLeft : '0.5rem' ,
27
28
} ,
29
+ control : {
30
+ display : 'flex' as 'flex' ,
31
+ alignItems : 'center' ,
32
+ fontSize : '70%' ,
33
+ } ,
34
+ levels : {
35
+ paddingBottom : '2rem' ,
36
+ } ,
28
37
}
29
38
30
39
const ReviewPage = ( props : Props ) => {
40
+ const [ stepVisibility , setStepVisibility ] = React . useState ( false )
31
41
return (
32
42
< div css = { styles . container } >
33
- < div css = { styles . header } > Review</ div >
34
- { props . levels . map ( ( level : T . LevelUI , index : number ) => (
35
- < div key = { level . id } >
36
- < div >
37
- < Content title = { level . title } content = { level . content } />
38
- < Steps steps = { level . steps } displayAll />
39
- </ div >
40
- { /* divider */ }
41
- { index < props . levels . length - 1 ? < hr /> : null }
43
+ < div css = { styles . header } >
44
+ < div > Review</ div >
45
+ < div css = { styles . control } >
46
+ < span > Show steps </ span >
47
+ < Switch checked = { stepVisibility } onChange = { ( checked ) => setStepVisibility ( checked ) } />
42
48
</ div >
43
- ) ) }
49
+ </ div >
50
+ < div css = { styles . levels } >
51
+ { props . levels . map ( ( level : T . LevelUI , index : number ) => (
52
+ < div key = { level . id } >
53
+ < div >
54
+ < Content title = { level . title } content = { level . content } />
55
+ { stepVisibility ? < Steps steps = { level . steps } displayAll /> : null }
56
+ </ div >
57
+ { /* divider */ }
58
+ { index < props . levels . length - 1 ? < hr /> : null }
59
+ </ div >
60
+ ) ) }
61
+ </ div >
44
62
</ div >
45
63
)
46
64
}
0 commit comments