Skip to content

Full Toolkit for Next-Level Domain Analysis

Input autofocus at the start (#12)

Mathis9be6da7507f6
diff --git a/app/lookup/[domain]/layout.tsx b/app/lookup/[domain]/layout.tsx
index e50b470..b6b7c3b 100644
--- a/app/lookup/[domain]/layout.tsx
+++ b/app/lookup/[domain]/layout.tsx
@@ -21,7 +21,7 @@ const LookupLayout: FC<LookupLayoutProps> = ({
<title>{`Results for ${domain} - Domain Digger`}</title>
<div className="container mb-8 max-w-xl">
- <SearchForm initialValue={domain} />
+ <SearchForm initialValue={domain} autofocus={false} />
</div>
<div className="container">
diff --git a/app/page.tsx b/app/page.tsx
index a6604a1..e25cf7f 100644
--- a/app/page.tsx
+++ b/app/page.tsx
@@ -15,7 +15,7 @@ const Home = () => {
Get details about any Domain
</h2>
- <SearchForm />
+ <SearchForm autofocus={true} />
</Card>
<Card className="mx-auto my-16 max-w-lg p-6">
diff --git a/components/SearchForm.tsx b/components/SearchForm.tsx
index cf83b37..fbded64 100644
--- a/components/SearchForm.tsx
+++ b/components/SearchForm.tsx
@@ -17,6 +17,7 @@ enum FormStates {
type SearchFormProps = {
initialValue?: string;
+ autofocus?: boolean;
};
const SearchForm = (props: SearchFormProps) => {
@@ -80,6 +81,7 @@ const SearchForm = (props: SearchFormProps) => {
setDomain(event.target.value)
}
disabled={state !== FormStates.Initial}
+ autoFocus={props.autofocus}
/>
<Button
className="flex-[1]"