import React from "react"; import { Link } from "react-router-dom"; import { Search } from "@customTypes/Search"; import { API } from "@api/Api"; import { UserProfile } from "@customTypes/Profile"; interface SearchProps { profile?: UserProfile; searchbarRef: React.RefObject; }; const _Search: React.FC = ({ profile, searchbarRef }) => { const [searchData, setSearchData] = React.useState( undefined ); const _handle_search_change = async (q: string) => { const searchResponse = await API.get_search(q); setSearchData(searchResponse); }; return (
_handle_search_change(e.target.value)} className="w-full py-2 px-[19px] bg-input rounded-[2000px] outline-none placeholder-bright placeholder:text-[18px] placeholder:font-barlow-semicondensed-regular" /> {searchData && (
{searchData?.maps.map((q, index) => ( {q.game} {q.chapter} {q.map} ))} {searchData?.players.map((q, index) => ( pfp {q.user_name} ))}
)}
) } export default _Search;