Don't display invalid state in GHE login form

This commit is contained in:
Sergio Padrino 2023-04-20 12:52:34 +02:00
parent ea449936b1
commit 0e5231db5d
2 changed files with 13 additions and 1 deletions

View file

@ -105,6 +105,7 @@ export class AuthenticationForm extends React.Component<
label="Username or email address" label="Username or email address"
disabled={disabled} disabled={disabled}
required={true} required={true}
displayInvalidState={false}
// eslint-disable-next-line jsx-a11y/no-autofocus // eslint-disable-next-line jsx-a11y/no-autofocus
autoFocus={true} autoFocus={true}
onValueChanged={this.onUsernameChange} onValueChanged={this.onUsernameChange}
@ -115,6 +116,7 @@ export class AuthenticationForm extends React.Component<
type="password" type="password"
disabled={disabled} disabled={disabled}
required={true} required={true}
displayInvalidState={false}
onValueChanged={this.onPasswordChange} onValueChanged={this.onPasswordChange}
/> />

View file

@ -28,6 +28,12 @@ export interface ITextBoxProps {
/** Indicates if input field should be required */ /** Indicates if input field should be required */
readonly required?: boolean readonly required?: boolean
/**
* Indicates whether or not the control displays an invalid state.
* Default: true
*/
readonly displayInvalidState?: boolean
/** /**
* Called when the user changes the value in the input field. * Called when the user changes the value in the input field.
* *
@ -244,7 +250,11 @@ export class TextBox extends React.Component<ITextBoxProps, ITextBoxState> {
const inputId = label ? this.state.inputId : undefined const inputId = label ? this.state.inputId : undefined
return ( return (
<div className={classNames('text-box-component', className)}> <div
className={classNames('text-box-component', className, {
'no-invalid-state': this.props.displayInvalidState === false,
})}
>
{label && <label htmlFor={inputId}>{label}</label>} {label && <label htmlFor={inputId}>{label}</label>}
<input <input