Unverified Commit 062e2e91 authored by Matri's avatar Matri Committed by GitHub

fix: login improvement (#941)

parent e0a48c49
...@@ -7,6 +7,7 @@ export type IButtonProps = { ...@@ -7,6 +7,7 @@ export type IButtonProps = {
className?: string className?: string
disabled?: boolean disabled?: boolean
loading?: boolean loading?: boolean
tabIndex?: number
children: React.ReactNode children: React.ReactNode
onClick?: MouseEventHandler<HTMLDivElement> onClick?: MouseEventHandler<HTMLDivElement>
} }
...@@ -18,6 +19,7 @@ const Button: FC<IButtonProps> = ({ ...@@ -18,6 +19,7 @@ const Button: FC<IButtonProps> = ({
className, className,
onClick, onClick,
loading = false, loading = false,
tabIndex,
}) => { }) => {
let style = 'cursor-pointer' let style = 'cursor-pointer'
switch (type) { switch (type) {
...@@ -35,6 +37,7 @@ const Button: FC<IButtonProps> = ({ ...@@ -35,6 +37,7 @@ const Button: FC<IButtonProps> = ({
return ( return (
<div <div
className={`inline-flex justify-center items-center content-center h-9 leading-5 rounded-lg px-4 py-2 text-base ${style} ${className && className}`} className={`inline-flex justify-center items-center content-center h-9 leading-5 rounded-lg px-4 py-2 text-base ${style} ${className && className}`}
tabIndex={tabIndex}
onClick={disabled ? undefined : onClick} onClick={disabled ? undefined : onClick}
> >
{children} {children}
......
...@@ -237,6 +237,10 @@ const NormalForm = () => { ...@@ -237,6 +237,10 @@ const NormalForm = () => {
id="password" id="password"
value={password} value={password}
onChange={e => setPassword(e.target.value)} onChange={e => setPassword(e.target.value)}
onKeyDown={(e) => {
if (e.key === 'Enter')
handleEmailPasswordLogin()
}}
type={showPassword ? 'text' : 'password'} type={showPassword ? 'text' : 'password'}
autoComplete="current-password" autoComplete="current-password"
placeholder={t('login.passwordPlaceholder') || ''} placeholder={t('login.passwordPlaceholder') || ''}
...@@ -256,6 +260,7 @@ const NormalForm = () => { ...@@ -256,6 +260,7 @@ const NormalForm = () => {
<div className='mb-2'> <div className='mb-2'>
<Button <Button
tabIndex={0}
type='primary' type='primary'
onClick={handleEmailPasswordLogin} onClick={handleEmailPasswordLogin}
disabled={isLoading} disabled={isLoading}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment