enhance search input
This commit is contained in:
@@ -46,7 +46,7 @@ export function HeaderSearchButton({
|
|||||||
// Focus input when expanded
|
// Focus input when expanded
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (expanded && inputRef.current) {
|
if (expanded && inputRef.current) {
|
||||||
const timer = setTimeout(() => inputRef.current?.focus(), 80);
|
const timer = setTimeout(() => inputRef.current?.focus(), 150);
|
||||||
return () => clearTimeout(timer);
|
return () => clearTimeout(timer);
|
||||||
}
|
}
|
||||||
}, [expanded]);
|
}, [expanded]);
|
||||||
@@ -142,13 +142,14 @@ export function HeaderSearchButton({
|
|||||||
className={cn(
|
className={cn(
|
||||||
"flex items-center gap-2 h-12 md:h-10 rounded-lg border border-border bg-background px-3 overflow-hidden",
|
"flex items-center gap-2 h-12 md:h-10 rounded-lg border border-border bg-background px-3 overflow-hidden",
|
||||||
"max-md:w-full",
|
"max-md:w-full",
|
||||||
"md:w-100!",
|
"md:max-w-100",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
ref={inputRef}
|
ref={inputRef}
|
||||||
type="text"
|
type="text"
|
||||||
defaultValue=""
|
defaultValue=""
|
||||||
|
autoFocus
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
queryRef.current = e.target.value;
|
queryRef.current = e.target.value;
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -76,8 +76,8 @@ export function PageHeader({
|
|||||||
{/* Actions — expands to fill width on mobile when search is active */}
|
{/* Actions — expands to fill width on mobile when search is active */}
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
"shrink-0 pt-1 flex items-center gap-1.5",
|
"pt-1 flex items-center gap-1.5",
|
||||||
searchExpanded && "max-md:flex-1 max-md:min-w-0",
|
searchExpanded ? "max-md:flex-1 max-md:min-w-0" : "shrink-0",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<HeaderSearchButton
|
<HeaderSearchButton
|
||||||
|
|||||||
Reference in New Issue
Block a user