diff options
author | Eugene Sokolov <eug-vs@keemail.me> | 2020-08-12 03:41:48 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-12 03:41:48 +0300 |
commit | 2dc5fc00347256982136deea98d483c444002595 (patch) | |
tree | bb3826d74842bc628d1c6aa9c43aae919faffcea /src/components/Header/SearchBar.tsx | |
parent | 94067ef2a0d9ac5c2aa5f45eca5366a2251ac04a (diff) | |
parent | 68c7660e13fc5613ef26de752bc360a792b3f935 (diff) | |
download | which-ui-2dc5fc00347256982136deea98d483c444002595.tar.gz |
Merge pull request #77 from which-ecosystem/redesign
Mobile search and basic drawer
Diffstat (limited to 'src/components/Header/SearchBar.tsx')
-rw-r--r-- | src/components/Header/SearchBar.tsx | 7 |
1 files changed, 6 insertions, 1 deletions
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 = ( |