Sfoglia il codice sorgente

feat: autofocus the email input on the login page (#3726)

jose-fully-ported 2 anni fa
parent
commit
b821a9ffd6

+ 3 - 0
dashboard/src/components/porter/Input.tsx

@@ -4,6 +4,7 @@ import { boolean } from "zod";
 import Tooltip from "./Tooltip";
 
 type Props = {
+  autoFocus?: boolean;
   placeholder: string;
   width?: string;
   value: string;
@@ -19,6 +20,7 @@ type Props = {
 };
 
 const Input: React.FC<Props> = ({
+  autoFocus,
   placeholder,
   width,
   value,
@@ -67,6 +69,7 @@ const Input: React.FC<Props> = ({
     <Block width={width}>
       {label && <Label>{label}</Label>}
       <StyledInput
+        autoFocus={autoFocus}
         value={value}
         onChange={handleChange}
         placeholder={placeholder}

+ 1 - 0
dashboard/src/main/auth/Login.tsx

@@ -186,6 +186,7 @@ const Login: React.FC<Props> = ({
         {hasBasic && (
           <>
             <Input
+              autoFocus={true}
               type="email"
               placeholder="Email"
               label="Email"