style: Login and registration 🛂 (#1214)

This commit is contained in:
MACHINSOFT 2023-11-25 00:49:14 +03:00 committed by GitHub
parent cc39074e0a
commit ebe62ad250
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 40 additions and 45 deletions

View file

@ -39,7 +39,7 @@ function Login() {
<p className="my-4 text-center text-sm font-light text-gray-700"> <p className="my-4 text-center text-sm font-light text-gray-700">
{' '} {' '}
{localize('com_auth_no_account')}{' '} {localize('com_auth_no_account')}{' '}
<a href="/register" className="p-1 text-green-500 hover:underline"> <a href="/register" className="p-1 font-medium text-green-500 hover:underline">
{localize('com_auth_sign_up')} {localize('com_auth_sign_up')}
</a> </a>
</p> </p>

View file

@ -45,18 +45,18 @@ function LoginForm({ onSubmit }: TLoginFormProps) {
}, },
})} })}
aria-invalid={!!errors.email} aria-invalid={!!errors.email}
className="peer block w-full appearance-none rounded-t-md border-0 border-b-2 border-gray-300 bg-gray-50 px-2.5 pb-2.5 pt-5 text-sm text-gray-900 focus:border-green-500 focus:outline-none focus:ring-0" className="peer block w-full appearance-none rounded-md border border-gray-300 bg-gray-50 px-2.5 pb-2.5 pt-5 text-sm text-gray-900 focus:border-green-500 focus:outline-none focus:ring-0"
placeholder=" " placeholder=" "
></input> ></input>
<label <label
htmlFor="email" htmlFor="email"
className="absolute left-2.5 top-4 z-10 origin-[0] -translate-y-4 scale-75 transform text-gray-500 duration-300 peer-placeholder-shown:translate-y-0 peer-placeholder-shown:scale-100 peer-focus:-translate-y-4 peer-focus:scale-75 peer-focus:text-green-500" className="pointer-events-none absolute left-2.5 top-4 z-10 origin-[0] -translate-y-4 scale-75 transform text-sm text-gray-500 duration-100 peer-placeholder-shown:translate-y-0 peer-placeholder-shown:scale-100 peer-focus:-translate-y-4 peer-focus:scale-75 peer-focus:text-green-500"
> >
{localize('com_auth_email_address')} {localize('com_auth_email_address')}
</label> </label>
</div> </div>
{errors.email && ( {errors.email && (
<span role="alert" className="mt-1 text-sm text-red-600"> <span role="alert" className="mt-1 text-sm text-black">
{/* @ts-ignore not sure why*/} {/* @ts-ignore not sure why*/}
{errors.email.message} {errors.email.message}
</span> </span>
@ -81,25 +81,25 @@ function LoginForm({ onSubmit }: TLoginFormProps) {
}, },
})} })}
aria-invalid={!!errors.password} aria-invalid={!!errors.password}
className="peer block w-full appearance-none rounded-t-md border-0 border-b-2 border-gray-300 bg-gray-50 px-2.5 pb-2.5 pt-5 text-sm text-gray-900 focus:border-green-500 focus:outline-none focus:ring-0" className="peer block w-full appearance-none rounded-md border border-gray-300 bg-gray-50 px-2.5 pb-2.5 pt-5 text-sm text-gray-900 focus:border-green-500 focus:outline-none focus:ring-0"
placeholder=" " placeholder=" "
></input> ></input>
<label <label
htmlFor="password" htmlFor="password"
className="absolute left-2.5 top-4 z-10 origin-[0] -translate-y-4 scale-75 transform text-gray-500 duration-300 peer-placeholder-shown:translate-y-0 peer-placeholder-shown:scale-100 peer-focus:-translate-y-4 peer-focus:scale-75 peer-focus:text-green-500" className="pointer-events-none absolute left-2.5 top-4 z-10 origin-[0] -translate-y-4 scale-75 transform text-sm text-gray-500 duration-100 peer-placeholder-shown:translate-y-0 peer-placeholder-shown:scale-100 peer-focus:-translate-y-4 peer-focus:scale-75 peer-focus:text-green-500"
> >
{localize('com_auth_password')} {localize('com_auth_password')}
</label> </label>
</div> </div>
{errors.password && ( {errors.password && (
<span role="alert" className="mt-1 text-sm text-red-600"> <span role="alert" className="mt-1 text-sm text-black">
{/* @ts-ignore not sure why*/} {/* @ts-ignore not sure why*/}
{errors.password.message} {errors.password.message}
</span> </span>
)} )}
</div> </div>
<a href="/forgot-password" className="text-sm text-green-500 hover:underline"> <a href="/forgot-password" className="text-sm font-medium text-green-500 hover:underline">
{localize('com_auth_password_forgot')} {localize('com_auth_password_forgot')}
</a> </a>
<div className="mt-6"> <div className="mt-6">
@ -107,8 +107,7 @@ function LoginForm({ onSubmit }: TLoginFormProps) {
aria-label="Sign in" aria-label="Sign in"
data-testid="login-button" data-testid="login-button"
type="submit" type="submit"
className="w-full transform rounded-sm bg-green-500 px-4 py-3 tracking-wide text-white transition-colors duration-200 hover:bg-green-600 focus:bg-green-600 focus:outline-none" className="w-full transform rounded-md bg-green-500 px-4 py-3 tracking-wide text-white transition-colors duration-200 hover:bg-green-600 focus:bg-green-600 focus:outline-none">
>
{localize('com_auth_continue')} {localize('com_auth_continue')}
</button> </button>
</div> </div>

View file

@ -90,19 +90,19 @@ function Registration() {
}, },
})} })}
aria-invalid={!!errors.name} aria-invalid={!!errors.name}
className="peer block w-full appearance-none rounded-t-md border-0 border-b-2 border-gray-300 bg-gray-50 px-2.5 pb-2.5 pt-5 text-sm text-gray-900 focus:border-green-500 focus:outline-none focus:ring-0" className="peer block w-full appearance-none rounded-md border border-gray-300 bg-gray-50 px-2.5 pb-2.5 pt-5 text-sm text-gray-900 focus:border-green-500 focus:outline-none focus:ring-0"
placeholder=" " placeholder=" "
></input> ></input>
<label <label
htmlFor="name" htmlFor="name"
className="absolute left-2.5 top-4 z-10 origin-[0] -translate-y-4 scale-75 transform text-sm text-gray-500 duration-300 peer-placeholder-shown:translate-y-0 peer-placeholder-shown:scale-100 peer-focus:-translate-y-4 peer-focus:scale-75 peer-focus:text-green-500" className="pointer-events-none absolute left-2.5 top-4 z-10 origin-[0] -translate-y-4 scale-75 transform text-sm text-gray-500 duration-100 peer-placeholder-shown:translate-y-0 peer-placeholder-shown:scale-100 peer-focus:-translate-y-4 peer-focus:scale-75 peer-focus:text-green-500"
> >
{localize('com_auth_full_name')} {localize('com_auth_full_name')}
</label> </label>
</div> </div>
{errors.name && ( {errors.name && (
<span role="alert" className="mt-1 text-sm text-red-600"> <span role="alert" className="mt-1 text-sm text-black">
{/* @ts-ignore not sure why*/} {/* @ts-ignore not sure why*/}
{errors.name.message} {errors.name.message}
</span> </span>
@ -126,20 +126,20 @@ function Registration() {
}, },
})} })}
aria-invalid={!!errors.username} aria-invalid={!!errors.username}
className="peer block w-full appearance-none rounded-t-md border-0 border-b-2 border-gray-300 bg-gray-50 px-2.5 pb-2.5 pt-5 text-sm text-gray-900 focus:border-green-500 focus:outline-none focus:ring-0" className="peer block w-full appearance-none rounded-md border border-gray-300 bg-gray-50 px-2.5 pb-2.5 pt-5 text-sm text-gray-900 focus:border-green-500 focus:outline-none focus:ring-0"
placeholder=" " placeholder=" "
autoComplete="off" autoComplete="off"
></input> ></input>
<label <label
htmlFor="username" htmlFor="username"
className="absolute left-2.5 top-4 z-10 origin-[0] -translate-y-4 scale-75 transform text-sm text-gray-500 duration-300 peer-placeholder-shown:translate-y-0 peer-placeholder-shown:scale-100 peer-focus:-translate-y-4 peer-focus:scale-75 peer-focus:text-green-500" className="pointer-events-none absolute left-2.5 top-4 z-10 origin-[0] -translate-y-4 scale-75 transform text-sm text-gray-500 duration-100 peer-placeholder-shown:translate-y-0 peer-placeholder-shown:scale-100 peer-focus:-translate-y-4 peer-focus:scale-75 peer-focus:text-green-500"
> >
{localize('com_auth_username')} {localize('com_auth_username')}
</label> </label>
</div> </div>
{errors.username && ( {errors.username && (
<span role="alert" className="mt-1 text-sm text-red-600"> <span role="alert" className="mt-1 text-sm text-black">
{/* @ts-ignore not sure why */} {/* @ts-ignore not sure why */}
{errors.username.message} {errors.username.message}
</span> </span>
@ -168,18 +168,18 @@ function Registration() {
}, },
})} })}
aria-invalid={!!errors.email} aria-invalid={!!errors.email}
className="peer block w-full appearance-none rounded-t-md border-0 border-b-2 border-gray-300 bg-gray-50 px-2.5 pb-2.5 pt-5 text-sm text-gray-900 focus:border-green-500 focus:outline-none focus:ring-0" className="peer block w-full appearance-none rounded-md border border-gray-300 bg-gray-50 px-2.5 pb-2.5 pt-5 text-sm text-gray-900 focus:border-green-500 focus:outline-none focus:ring-0"
placeholder=" " placeholder=" "
></input> ></input>
<label <label
htmlFor="email" htmlFor="email"
className="absolute left-2.5 top-4 z-10 origin-[0] -translate-y-4 scale-75 transform text-sm text-gray-500 duration-300 peer-placeholder-shown:translate-y-0 peer-placeholder-shown:scale-100 peer-focus:-translate-y-4 peer-focus:scale-75 peer-focus:text-green-500" className="pointer-events-none absolute left-2.5 top-4 z-10 origin-[0] -translate-y-4 scale-75 transform text-sm text-gray-500 duration-100 peer-placeholder-shown:translate-y-0 peer-placeholder-shown:scale-100 peer-focus:-translate-y-4 peer-focus:scale-75 peer-focus:text-green-500"
> >
{localize('com_auth_email')} {localize('com_auth_email')}
</label> </label>
</div> </div>
{errors.email && ( {errors.email && (
<span role="alert" className="mt-1 text-sm text-red-600"> <span role="alert" className="mt-1 text-sm text-black">
{/* @ts-ignore - Type 'string | FieldError | Merge<FieldError, FieldErrorsImpl<any>> | undefined' is not assignable to type 'ReactNode' */} {/* @ts-ignore - Type 'string | FieldError | Merge<FieldError, FieldErrorsImpl<any>> | undefined' is not assignable to type 'ReactNode' */}
{errors.email.message} {errors.email.message}
</span> </span>
@ -205,19 +205,19 @@ function Registration() {
}, },
})} })}
aria-invalid={!!errors.password} aria-invalid={!!errors.password}
className="peer block w-full appearance-none rounded-t-md border-0 border-b-2 border-gray-300 bg-gray-50 px-2.5 pb-2.5 pt-5 text-sm text-gray-900 focus:border-green-500 focus:outline-none focus:ring-0" className="peer block w-full appearance-none rounded-md border border-gray-300 bg-gray-50 px-2.5 pb-2.5 pt-5 text-sm text-gray-900 focus:border-green-500 focus:outline-none focus:ring-0"
placeholder=" " placeholder=" "
></input> ></input>
<label <label
htmlFor="password" htmlFor="password"
className="absolute left-2.5 top-4 z-10 origin-[0] -translate-y-4 scale-75 transform text-sm text-gray-500 duration-300 peer-placeholder-shown:translate-y-0 peer-placeholder-shown:scale-100 peer-focus:-translate-y-4 peer-focus:scale-75 peer-focus:text-green-500" className="pointer-events-none absolute left-2.5 top-4 z-10 origin-[0] -translate-y-4 scale-75 transform text-sm text-gray-500 duration-100 peer-placeholder-shown:translate-y-0 peer-placeholder-shown:scale-100 peer-focus:-translate-y-4 peer-focus:scale-75 peer-focus:text-green-500"
> >
{localize('com_auth_password')} {localize('com_auth_password')}
</label> </label>
</div> </div>
{errors.password && ( {errors.password && (
<span role="alert" className="mt-1 text-sm text-red-600"> <span role="alert" className="mt-1 text-sm text-black">
{/* @ts-ignore not sure why */} {/* @ts-ignore not sure why */}
{errors.password.message} {errors.password.message}
</span> </span>
@ -240,19 +240,19 @@ function Registration() {
value === password || localize('com_auth_password_not_match'), value === password || localize('com_auth_password_not_match'),
})} })}
aria-invalid={!!errors.confirm_password} aria-invalid={!!errors.confirm_password}
className="peer block w-full appearance-none rounded-t-md border-0 border-b-2 border-gray-300 bg-gray-50 px-2.5 pb-2.5 pt-5 text-sm text-gray-900 focus:border-green-500 focus:outline-none focus:ring-0" className="peer block w-full appearance-none rounded-md border border-gray-300 bg-gray-50 px-2.5 pb-2.5 pt-5 text-sm text-gray-900 focus:border-green-500 focus:outline-none focus:ring-0"
placeholder=" " placeholder=" "
></input> ></input>
<label <label
htmlFor="confirm_password" htmlFor="confirm_password"
className="absolute left-2.5 top-4 z-10 origin-[0] -translate-y-4 scale-75 transform text-sm text-gray-500 duration-300 peer-placeholder-shown:translate-y-0 peer-placeholder-shown:scale-100 peer-focus:-translate-y-4 peer-focus:scale-75 peer-focus:text-green-500" className="pointer-events-none absolute left-2.5 top-4 z-10 origin-[0] -translate-y-4 scale-75 transform text-sm text-gray-500 duration-100 peer-placeholder-shown:translate-y-0 peer-placeholder-shown:scale-100 peer-focus:-translate-y-4 peer-focus:scale-75 peer-focus:text-green-500"
> >
{localize('com_auth_password_confirm')} {localize('com_auth_password_confirm')}
</label> </label>
</div> </div>
{errors.confirm_password && ( {errors.confirm_password && (
<span role="alert" className="mt-1 text-sm text-red-600"> <span role="alert" className="mt-1 text-sm text-black">
{/* @ts-ignore not sure why */} {/* @ts-ignore not sure why */}
{errors.confirm_password.message} {errors.confirm_password.message}
</span> </span>
@ -269,7 +269,7 @@ function Registration() {
} }
type="submit" type="submit"
aria-label="Submit registration" aria-label="Submit registration"
className="w-full transform rounded-sm bg-green-500 px-4 py-3 tracking-wide text-white transition-colors duration-200 hover:bg-green-600 focus:bg-green-600 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-green-500" className="w-full transform rounded-md bg-green-500 px-4 py-3 tracking-wide text-white transition-colors duration-200 hover:bg-green-600 focus:bg-green-600 focus:outline-none disabled:cursor-not-allowed disabled:hover:bg-green-500"
> >
{localize('com_auth_continue')} {localize('com_auth_continue')}
</button> </button>
@ -281,8 +281,7 @@ function Registration() {
<a <a
href="/login" href="/login"
aria-label="Login" aria-label="Login"
className="p-1 font-medium text-green-500 hover:underline" className="p-1 font-medium text-green-500 hover:underline">
>
{localize('com_auth_login')} {localize('com_auth_login')}
</a> </a>
</p> </p>

View file

@ -111,18 +111,17 @@ function RequestPasswordReset() {
}, },
})} })}
aria-invalid={!!errors.email} aria-invalid={!!errors.email}
className="peer block w-full appearance-none rounded-t-md border-0 border-b-2 border-gray-300 bg-gray-50 px-2.5 pb-2.5 pt-5 text-sm text-gray-900 focus:border-green-500 focus:outline-none focus:ring-0" className="peer block w-full appearance-none rounded-md border border-gray-300 bg-gray-50 px-2.5 pb-2.5 pt-5 text-sm text-gray-900 focus:border-green-500 focus:outline-none focus:ring-0"
placeholder=" " placeholder=" "
></input> ></input>
<label <label
htmlFor="email" htmlFor="email"
className="absolute left-2.5 top-4 z-10 origin-[0] -translate-y-4 scale-75 transform text-gray-500 duration-300 peer-placeholder-shown:translate-y-0 peer-placeholder-shown:scale-100 peer-focus:-translate-y-4 peer-focus:scale-75 peer-focus:text-green-500" className="pointer-events-none absolute left-2.5 top-4 z-10 origin-[0] -translate-y-4 scale-75 transform text-sm text-gray-500 duration-100 peer-placeholder-shown:translate-y-0 peer-placeholder-shown:scale-100 peer-focus:-translate-y-4 peer-focus:scale-75 peer-focus:text-green-500">
>
{localize('com_auth_email_address')} {localize('com_auth_email_address')}
</label> </label>
</div> </div>
{errors.email && ( {errors.email && (
<span role="alert" className="mt-1 text-sm text-red-600"> <span role="alert" className="mt-1 text-sm text-black">
{/* @ts-ignore not sure why */} {/* @ts-ignore not sure why */}
{errors.email.message} {errors.email.message}
</span> </span>
@ -132,8 +131,7 @@ function RequestPasswordReset() {
<button <button
type="submit" type="submit"
disabled={!!errors.email} disabled={!!errors.email}
className="w-full rounded-sm border border-transparent bg-green-500 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-green-600 focus:outline-none active:bg-green-500" className="w-full transform rounded-md bg-green-500 px-4 py-3 tracking-wide text-white transition-colors duration-200 hover:bg-green-600 focus:bg-green-600 focus:outline-none">
>
{localize('com_auth_continue')} {localize('com_auth_continue')}
</button> </button>
</div> </div>

View file

@ -44,7 +44,7 @@ function ResetPassword() {
<button <button
onClick={() => navigate('/login')} onClick={() => navigate('/login')}
aria-label={localize('com_auth_sign_in')} aria-label={localize('com_auth_sign_in')}
className="w-full transform rounded-sm bg-green-500 px-4 py-3 tracking-wide text-white transition-colors duration-200 hover:bg-green-600 focus:bg-green-600 focus:outline-none" className="w-full transform rounded-md bg-green-500 px-4 py-3 tracking-wide text-white transition-colors duration-200 hover:bg-green-600 focus:bg-green-600 focus:outline-none"
> >
{localize('com_auth_continue')} {localize('com_auth_continue')}
</button> </button>
@ -109,19 +109,19 @@ function ResetPassword() {
}, },
})} })}
aria-invalid={!!errors.password} aria-invalid={!!errors.password}
className="peer block w-full appearance-none rounded-t-md border-0 border-b-2 border-gray-300 bg-gray-50 px-2.5 pb-2.5 pt-5 text-sm text-gray-900 focus:border-green-500 focus:outline-none focus:ring-0" className="peer block w-full appearance-none rounded-md border border-gray-300 bg-gray-50 px-2.5 pb-2.5 pt-5 text-sm text-gray-900 focus:border-green-500 focus:outline-none focus:ring-0"
placeholder=" " placeholder=" "
></input> ></input>
<label <label
htmlFor="password" htmlFor="password"
className="absolute left-2.5 top-4 z-10 origin-[0] -translate-y-4 scale-75 transform text-sm text-gray-500 duration-300 peer-placeholder-shown:translate-y-0 peer-placeholder-shown:scale-100 peer-focus:-translate-y-4 peer-focus:scale-75 peer-focus:text-green-500" className="pointer-events-none absolute left-2.5 top-4 z-10 origin-[0] -translate-y-4 scale-75 transform text-sm text-gray-500 duration-100 peer-placeholder-shown:translate-y-0 peer-placeholder-shown:scale-100 peer-focus:-translate-y-4 peer-focus:scale-75 peer-focus:text-green-500"
> >
{localize('com_auth_password')} {localize('com_auth_password')}
</label> </label>
</div> </div>
{errors.password && ( {errors.password && (
<span role="alert" className="mt-1 text-sm text-red-600"> <span role="alert" className="mt-1 text-sm text-black">
{/* @ts-ignore not sure why */} {/* @ts-ignore not sure why */}
{errors.password.message} {errors.password.message}
</span> </span>
@ -143,30 +143,30 @@ function ResetPassword() {
value === password || localize('com_auth_password_not_match'), value === password || localize('com_auth_password_not_match'),
})} })}
aria-invalid={!!errors.confirm_password} aria-invalid={!!errors.confirm_password}
className="peer block w-full appearance-none rounded-t-md border-0 border-b-2 border-gray-300 bg-gray-50 px-2.5 pb-2.5 pt-5 text-sm text-gray-900 focus:border-green-500 focus:outline-none focus:ring-0" className="peer block w-full appearance-none rounded-md border border-gray-300 bg-gray-50 px-2.5 pb-2.5 pt-5 text-sm text-gray-900 focus:border-green-500 focus:outline-none focus:ring-0"
placeholder=" " placeholder=" "
></input> ></input>
<label <label
htmlFor="confirm_password" htmlFor="confirm_password"
className="absolute left-2.5 top-4 z-10 origin-[0] -translate-y-4 scale-75 transform text-sm text-gray-500 duration-300 peer-placeholder-shown:translate-y-0 peer-placeholder-shown:scale-100 peer-focus:-translate-y-4 peer-focus:scale-75 peer-focus:text-green-500" className="pointer-events-none absolute left-2.5 top-4 z-10 origin-[0] -translate-y-4 scale-75 transform text-sm text-gray-500 duration-100 peer-placeholder-shown:translate-y-0 peer-placeholder-shown:scale-100 peer-focus:-translate-y-4 peer-focus:scale-75 peer-focus:text-green-500"
> >
{localize('com_auth_password_confirm')} {localize('com_auth_password_confirm')}
</label> </label>
</div> </div>
{errors.confirm_password && ( {errors.confirm_password && (
<span role="alert" className="mt-1 text-sm text-red-600"> <span role="alert" className="mt-1 text-sm text-black">
{/* @ts-ignore not sure why */} {/* @ts-ignore not sure why */}
{errors.confirm_password.message} {errors.confirm_password.message}
</span> </span>
)} )}
{errors.token && ( {errors.token && (
<span role="alert" className="mt-1 text-sm text-red-600"> <span role="alert" className="mt-1 text-sm text-black">
{/* @ts-ignore not sure why */} {/* @ts-ignore not sure why */}
{errors.token.message} {errors.token.message}
</span> </span>
)} )}
{errors.userId && ( {errors.userId && (
<span role="alert" className="mt-1 text-sm text-red-600"> <span role="alert" className="mt-1 text-sm text-black">
{/* @ts-ignore not sure why */} {/* @ts-ignore not sure why */}
{errors.userId.message} {errors.userId.message}
</span> </span>
@ -177,8 +177,7 @@ function ResetPassword() {
disabled={!!errors.password || !!errors.confirm_password} disabled={!!errors.password || !!errors.confirm_password}
type="submit" type="submit"
aria-label={localize('com_auth_submit_registration')} aria-label={localize('com_auth_submit_registration')}
className="w-full transform rounded-sm bg-green-500 px-4 py-3 tracking-wide text-white transition-colors duration-200 hover:bg-green-600 focus:bg-green-600 focus:outline-none" className="w-full transform rounded-md bg-green-500 px-4 py-3 tracking-wide text-white transition-colors duration-200 hover:bg-green-600 focus:bg-green-600 focus:outline-none">
>
{localize('com_auth_continue')} {localize('com_auth_continue')}
</button> </button>
</div> </div>