mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-29 13:52:10 +03:00
Cleaned disabling input fields for preview mode
refs 7c3e724874
- extracts disable logic in preview mode to common component
This commit is contained in:
parent
7c3e724874
commit
1642afc25a
@ -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 = '';
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user