diff --git a/.circleci/config.yml b/.circleci/config.yml index abe65e8480..856330daff 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -260,7 +260,7 @@ workflows: filters: branches: only: - - develop + - pass-screen-updates # Production builds are exectuted # when PR is merged to the master # Don't change anything in this configuration diff --git a/__tests__/shared/components/GUIKit/TextInput/__snapshots__/index.jsx.snap b/__tests__/shared/components/GUIKit/TextInput/__snapshots__/index.jsx.snap index 1d2c532062..f7c29a7f58 100644 --- a/__tests__/shared/components/GUIKit/TextInput/__snapshots__/index.jsx.snap +++ b/__tests__/shared/components/GUIKit/TextInput/__snapshots__/index.jsx.snap @@ -9,6 +9,7 @@ exports[`Default render 1`] = ` defaultValue="" onBlur={[Function]} onChange={[Function]} + onKeyPress={[Function]} placeholder="" type="text" /> diff --git a/src/shared/components/Contentful/PasswordScreen/index.jsx b/src/shared/components/Contentful/PasswordScreen/index.jsx index a323ff6a46..c574520af5 100644 --- a/src/shared/components/Contentful/PasswordScreen/index.jsx +++ b/src/shared/components/Contentful/PasswordScreen/index.jsx @@ -21,10 +21,12 @@ export default class PasswordScreen extends React.Component { onSubmit() { const { password } = this.props; - const { inputVal } = this.state; - this.setState({ - authorized: password === inputVal, - errorMsg: password === inputVal ? '' : 'Password incorrect', + this.setState((state) => { + const { inputVal } = state; + return { + authorized: password === inputVal, + errorMsg: password === inputVal ? '' : 'Password incorrect', + }; }); } @@ -41,7 +43,7 @@ export default class PasswordScreen extends React.Component { authorized, errorMsg, inputVal, } = this.state; const { - viewPortId, preview, spaceName, environment, baseUrl, title, + viewPortId, preview, spaceName, environment, baseUrl, title, btnText, content, } = this.props; return authorized ? ( this.onPasswordInput(val)} errorMsg={errorMsg} required + type="password" + onEnterKey={this.onSubmit} />
- +
+ { + content ? ( + + ) : null + } ); } @@ -78,6 +93,8 @@ PasswordScreen.defaultProps = { environment: null, baseUrl: '', title: 'GET ACCESS WITH PASSWORD', + btnText: 'SUBMIT', + content: null, }; PasswordScreen.propTypes = { @@ -88,4 +105,6 @@ PasswordScreen.propTypes = { environment: PT.string, baseUrl: PT.string, title: PT.string, + btnText: PT.string, + content: PT.shape(), }; diff --git a/src/shared/components/Contentful/Route.jsx b/src/shared/components/Contentful/Route.jsx index 18c23943f8..78876bb229 100644 --- a/src/shared/components/Contentful/Route.jsx +++ b/src/shared/components/Contentful/Route.jsx @@ -71,6 +71,8 @@ function ChildRoutesLoader(props) { environment={environment} baseUrl={url} title={fields.passwordScreenTitle} + btnText={fields.passwordScreenButtonText} + content={fields.passwordScreenContent} /> ) ) : diff --git a/src/shared/components/GUIKit/TextInput/index.jsx b/src/shared/components/GUIKit/TextInput/index.jsx index a69881350c..519ea50dc6 100644 --- a/src/shared/components/GUIKit/TextInput/index.jsx +++ b/src/shared/components/GUIKit/TextInput/index.jsx @@ -17,6 +17,8 @@ function TextInput({ onChange, required, size, + type, + onEnterKey, }) { const [val, setVal] = useState(value); const delayedOnChange = useRef( @@ -28,7 +30,7 @@ function TextInput({
{ @@ -39,6 +41,11 @@ function TextInput({ delayedOnChange(e.target.value, onChange); setVal(e.target.value); }} + onKeyPress={(e) => { + if (e.key === 'Enter') { + onEnterKey(); + } + }} /> {label ? (