From afda959598a04553e0a27c5b543f161472b79828 Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
Date: Wed, 12 Aug 2020 02:32:57 +0300
Subject: feat: implement mobile search

---
 src/components/Header/SearchBar.tsx | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

(limited to 'src/components/Header/SearchBar.tsx')

diff --git a/src/components/Header/SearchBar.tsx b/src/components/Header/SearchBar.tsx
index 8bfe0fb..ea6e6ac 100644
--- a/src/components/Header/SearchBar.tsx
+++ b/src/components/Header/SearchBar.tsx
@@ -15,6 +15,10 @@ import { User } from 'which-types';
 import { get } from '../../requests';
 import UserStrip from '../UserStrip/UserStrip';
 
+interface PropTypes {
+  callback?: () => void;
+}
+
 const INTERVAL = 300;
 const LIMIT = 7;
 
@@ -37,7 +41,7 @@ const useStyles = makeStyles(theme => ({
   }
 }));
 
-const SearchBar: React.FC = React.memo(() => {
+const SearchBar: React.FC<PropTypes> = React.memo(({ callback }) => {
   const [results, setResults] = useState<User[]>([]);
   const [query, setQuery] = useState<string>('');
   const [debouncedQuery, setDebouncedQuery] = useState<string>(query);
@@ -72,6 +76,7 @@ const SearchBar: React.FC = React.memo(() => {
     const { username } = results[index];
     history.push(`/profile/${username}`);
     handleClose();
+    if (callback) callback();
   };
 
   const SearchResults = (
-- 
cgit v1.2.3

