0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-01-06 20:40:08 -05:00

fix(console): error message in text input component (#1060)

This commit is contained in:
Xiao Yijun 2022-06-07 12:26:22 +08:00 committed by GitHub
parent 5a5083e863
commit 93916bfa54
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 6 deletions

View file

@ -14,22 +14,21 @@ const TextInput = (
reference: ForwardedRef<HTMLInputElement> reference: ForwardedRef<HTMLInputElement>
) => { ) => {
return ( return (
<> <div className={className}>
<div <div
className={classNames( className={classNames(
styles.container, styles.container,
hasError && styles.error, hasError && styles.error,
icon && styles.withIcon, icon && styles.withIcon,
disabled && styles.disabled, disabled && styles.disabled,
readOnly && styles.readOnly, readOnly && styles.readOnly
className
)} )}
> >
{icon && <span className={styles.icon}>{icon}</span>} {icon && <span className={styles.icon}>{icon}</span>}
<input type="text" {...rest} ref={reference} disabled={disabled} readOnly={readOnly} /> <input type="text" {...rest} ref={reference} disabled={disabled} readOnly={readOnly} />
</div> </div>
{hasError && errorMessage && <div className={styles.errorMessage}>{errorMessage}</div>} {hasError && errorMessage && <div className={styles.errorMessage}>{errorMessage}</div>}
</> </div>
); );
}; };

View file

@ -111,7 +111,7 @@ const BrandingForm = () => {
<FormField isRequired={isSloganRequired} title="admin_console.sign_in_exp.branding.slogan"> <FormField isRequired={isSloganRequired} title="admin_console.sign_in_exp.branding.slogan">
<TextInput <TextInput
{...register('branding.slogan', { required: isSloganRequired })} {...register('branding.slogan', { required: isSloganRequired })}
hasError={Boolean(isSloganRequired && errors.branding?.slogan)} hasError={Boolean(errors.branding?.slogan)}
/> />
</FormField> </FormField>
</> </>

View file

@ -34,7 +34,7 @@ const TermsForm = () => {
> >
<TextInput <TextInput
{...register('termsOfUse.contentUrl', { required: enabled })} {...register('termsOfUse.contentUrl', { required: enabled })}
hasError={Boolean(enabled && errors.termsOfUse)} hasError={Boolean(errors.termsOfUse)}
/> />
</FormField> </FormField>
</> </>