aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/components/Sidebar/Search.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/components/Sidebar/Search.tsx')
-rw-r--r--frontend/src/components/Sidebar/Search.tsx9
1 files changed, 4 insertions, 5 deletions
diff --git a/frontend/src/components/Sidebar/Search.tsx b/frontend/src/components/Sidebar/Search.tsx
index 00d9e1e..49bcec7 100644
--- a/frontend/src/components/Sidebar/Search.tsx
+++ b/frontend/src/components/Sidebar/Search.tsx
@@ -1,4 +1,4 @@
1import React, { useRef } from "react"; 1import React from "react";
2import { Link } from "react-router-dom"; 2import { Link } from "react-router-dom";
3 3
4import { Search } from "@customTypes/Search"; 4import { Search } from "@customTypes/Search";
@@ -7,21 +7,20 @@ import { UserProfile } from "@customTypes/Profile";
7 7
8interface SearchProps { 8interface SearchProps {
9 profile?: UserProfile; 9 profile?: UserProfile;
10 searchbarRef: React.RefObject<HTMLInputElement | null>;
10}; 11};
11 12
12const _Search: React.FC<SearchProps> = ({ profile }) => { 13const _Search: React.FC<SearchProps> = ({ profile, searchbarRef }) => {
13 const [searchData, setSearchData] = React.useState<Search | undefined>( 14 const [searchData, setSearchData] = React.useState<Search | undefined>(
14 undefined 15 undefined
15 ); 16 );
16 17
17 const searchbarRef = useRef<HTMLInputElement>(null);
18
19 const _handle_search_change = async (q: string) => { 18 const _handle_search_change = async (q: string) => {
20 const searchResponse = await API.get_search(q); 19 const searchResponse = await API.get_search(q);
21 setSearchData(searchResponse); 20 setSearchData(searchResponse);
22 }; 21 };
23 return ( 22 return (
24 <div className="flex w-full flex-col justify-between p-3"> 23 <div className="flex w-full flex-col p-3 not-md:absolute">
25 <input 24 <input
26 ref={searchbarRef} 25 ref={searchbarRef}
27 type="text" 26 type="text"