From a8361c2d7e94f89c4dd3220c6a3fad0473eb46ce Mon Sep 17 00:00:00 2001 From: en Date: Tue, 4 Feb 2025 13:14:47 +0100 Subject: [PATCH] fix(search): sync search states on navigation --- src/components/SearchInput.tsx | 4 +++- src/pages/blogs/index.tsx | 24 +++++++++++++++++++++--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/components/SearchInput.tsx b/src/components/SearchInput.tsx index 3bf7d19..cc2f6bc 100644 --- a/src/components/SearchInput.tsx +++ b/src/components/SearchInput.tsx @@ -3,10 +3,11 @@ import { forwardRef } from 'react' interface SearchInputProps { handleKeyDown: (event: React.KeyboardEvent) => void handleSearch: () => void + handleChange?: (event: React.ChangeEvent) => void } export const SearchInput = forwardRef( - ({ handleKeyDown, handleSearch }, ref) => ( + ({ handleKeyDown, handleSearch, handleChange }, ref) => (
@@ -15,6 +16,7 @@ export const SearchInput = forwardRef( className='SMIWInput' ref={ref} onKeyDown={handleKeyDown} + onChange={handleChange} placeholder='Enter search term' />