Cleaned disabling input fields for preview mode

refs 7c3e724874

- extracts disable logic in preview mode to common component
This commit is contained in:
Rishabh 2021-09-02 15:22:18 +05:30
parent 7c3e724874
commit 1642afc25a
2 changed files with 8 additions and 3 deletions

View File

@ -1,4 +1,5 @@
import React, {useEffect, useRef} from 'react';
import {hasMode} from '../../utils/check-mode';
import {isCookiesDisabled} from '../../utils/helpers';
export const InputFieldStyles = `
@ -86,7 +87,7 @@ function InputField({
type,
value,
placeholder,
disabled,
disabled = false,
onChange = () => {},
onBlur = () => {},
onKeyDown = () => {},
@ -102,6 +103,12 @@ function InputField({
if (isCookiesDisabled()) {
disabled = true;
}
// Disable all input fields in preview mode
if (hasMode(['preview'])) {
disabled = true;
}
let autocomplete = '';
let autocorrect = '';
let autocapitalize = '';

View File

@ -346,7 +346,6 @@ class SignupPage extends React.Component {
type: 'email',
value: state.email,
placeholder: 'jamie@example.com',
disabled: (hasMode(['preview']) ? 'disabled' : ''),
label: 'Email',
name: 'email',
required: true,
@ -361,7 +360,6 @@ class SignupPage extends React.Component {
type: 'text',
value: state.name,
placeholder: 'Jamie Larson',
disabled: (hasMode(['preview']) ? 'disabled' : ''),
label: 'Name',
name: 'name',
required: true,