@@ -21,10 +21,12 @@ export default class PasswordScreen extends React.Component {
21
21
22
22
onSubmit ( ) {
23
23
const { password } = this . props ;
24
- const { inputVal } = this . state ;
25
- this . setState ( {
26
- authorized : password === inputVal ,
27
- errorMsg : password === inputVal ? '' : 'Password incorrect' ,
24
+ this . setState ( ( state ) => {
25
+ const { inputVal } = state ;
26
+ return {
27
+ authorized : password === inputVal ,
28
+ errorMsg : password === inputVal ? '' : 'Password incorrect' ,
29
+ } ;
28
30
} ) ;
29
31
}
30
32
@@ -41,7 +43,7 @@ export default class PasswordScreen extends React.Component {
41
43
authorized, errorMsg, inputVal,
42
44
} = this . state ;
43
45
const {
44
- viewPortId, preview, spaceName, environment, baseUrl, title,
46
+ viewPortId, preview, spaceName, environment, baseUrl, title, btnText , content ,
45
47
} = this . props ;
46
48
return authorized ? (
47
49
< Viewport
@@ -62,11 +64,24 @@ export default class PasswordScreen extends React.Component {
62
64
onChange = { val => this . onPasswordInput ( val ) }
63
65
errorMsg = { errorMsg }
64
66
required
67
+ type = "password"
68
+ onEnterKey = { this . onSubmit }
65
69
/>
66
70
< div styleName = "cta" >
67
- < button type = "button" styleName = "submit" onClick = { this . onSubmit } disabled = { ! inputVal } > SUBMIT </ button >
71
+ < button type = "button" styleName = "submit" onClick = { this . onSubmit } disabled = { ! inputVal } > { btnText } </ button >
68
72
</ div >
69
73
</ div >
74
+ {
75
+ content ? (
76
+ < Viewport
77
+ id = { content . sys . id }
78
+ preview = { preview }
79
+ spaceName = { spaceName }
80
+ environment = { environment }
81
+ baseUrl = { baseUrl }
82
+ />
83
+ ) : null
84
+ }
70
85
</ div >
71
86
) ;
72
87
}
@@ -78,6 +93,8 @@ PasswordScreen.defaultProps = {
78
93
environment : null ,
79
94
baseUrl : '' ,
80
95
title : 'GET ACCESS WITH PASSWORD' ,
96
+ btnText : 'SUBMIT' ,
97
+ content : null ,
81
98
} ;
82
99
83
100
PasswordScreen . propTypes = {
@@ -88,4 +105,6 @@ PasswordScreen.propTypes = {
88
105
environment : PT . string ,
89
106
baseUrl : PT . string ,
90
107
title : PT . string ,
108
+ btnText : PT . string ,
109
+ content : PT . shape ( ) ,
91
110
} ;
0 commit comments