Tom Kirkpatrick
6 years ago
No known key found for this signature in database
GPG Key ID: 72203A8EC5967EA8
2 changed files with
4 additions and
4 deletions
-
app/components/UI/Input.js
-
app/components/UI/TextArea.js
|
@ -94,7 +94,7 @@ class Input extends React.Component { |
|
|
const { hasFocus } = this.state |
|
|
const { hasFocus } = this.state |
|
|
const { setValue, setTouched } = fieldApi |
|
|
const { setValue, setTouched } = fieldApi |
|
|
const { value } = fieldState |
|
|
const { value } = fieldState |
|
|
const isValid = value && !fieldState.error |
|
|
const isValid = value && !fieldState.error && !fieldState.asyncError && fieldState.touched |
|
|
|
|
|
|
|
|
// Calculate the border color based on the current field state.
|
|
|
// Calculate the border color based on the current field state.
|
|
|
let borderColor |
|
|
let borderColor |
|
@ -102,7 +102,7 @@ class Input extends React.Component { |
|
|
borderColor = theme.colors.gray |
|
|
borderColor = theme.colors.gray |
|
|
} else if (fieldState.error || fieldState.asyncError) { |
|
|
} else if (fieldState.error || fieldState.asyncError) { |
|
|
borderColor = theme.colors.superRed |
|
|
borderColor = theme.colors.superRed |
|
|
} else if (value && (!fieldState.error && !fieldState.asyncError)) { |
|
|
} else if (isValid) { |
|
|
borderColor = theme.colors.superGreen |
|
|
borderColor = theme.colors.superGreen |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
@ -72,7 +72,7 @@ class TextArea extends React.PureComponent { |
|
|
const { hasFocus } = this.state |
|
|
const { hasFocus } = this.state |
|
|
const { setValue, setTouched } = fieldApi |
|
|
const { setValue, setTouched } = fieldApi |
|
|
const { value } = fieldState |
|
|
const { value } = fieldState |
|
|
const isValid = value && !fieldState.error |
|
|
const isValid = value && !fieldState.error && !fieldState.asyncError && fieldState.touched |
|
|
|
|
|
|
|
|
// Calculate the border color based on the current field state.
|
|
|
// Calculate the border color based on the current field state.
|
|
|
let borderColor |
|
|
let borderColor |
|
@ -80,7 +80,7 @@ class TextArea extends React.PureComponent { |
|
|
borderColor = theme.colors.gray |
|
|
borderColor = theme.colors.gray |
|
|
} else if (fieldState.error || fieldState.asyncError) { |
|
|
} else if (fieldState.error || fieldState.asyncError) { |
|
|
borderColor = theme.colors.superRed |
|
|
borderColor = theme.colors.superRed |
|
|
} else if (value && (!fieldState.error && !fieldState.asyncError)) { |
|
|
} else if (isValid) { |
|
|
borderColor = theme.colors.superGreen |
|
|
borderColor = theme.colors.superGreen |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|