diff --git a/apps/docs/components/Search.tsx b/apps/docs/components/Search.tsx index ea34b4686..bc1697b04 100644 --- a/apps/docs/components/Search.tsx +++ b/apps/docs/components/Search.tsx @@ -8,6 +8,7 @@ export function Search({ activeId }: { activeId: string | null }) { const [query, setQuery] = useState('') const [results, setResults] = useState([]) const rResultsList = useRef(null) + const [isDisabled, setIsDisabled] = useState(false) const handleChange = useCallback((e: React.ChangeEvent) => { setQuery(e.target.value) @@ -63,6 +64,7 @@ export function Search({ activeId }: { activeId: string | null }) { useEffect(() => { setQuery('') setResults([]) + setIsDisabled(false) }, [router.asPath]) const handleFocus = useCallback(() => { @@ -74,6 +76,7 @@ export function Search({ activeId }: { activeId: string | null }) { const handleKeyDown = useCallback( (e: React.KeyboardEvent) => { if (e.key === 'Enter') { + setIsDisabled(true) router.push(`/search-results?q=${rInput.current!.value}`) } }, @@ -96,6 +99,7 @@ export function Search({ activeId }: { activeId: string | null }) { autoCapitalize="off" autoComplete="off" autoCorrect="off" + disabled={isDisabled} /> {results.length > 0 && ( diff --git a/apps/docs/styles/globals.css b/apps/docs/styles/globals.css index 1557393df..0f1fdace5 100644 --- a/apps/docs/styles/globals.css +++ b/apps/docs/styles/globals.css @@ -653,6 +653,11 @@ body { background: none; } +.search__input:disabled { + background-color: var(--color-tint-1); + color: var(--color-tint-5); +} + .search__input::placeholder { color: var(--color-tint-4); }