import React, { useRef } from "react"; import { Link } from "react-router-dom"; import { UserProfile } from "@customTypes/Profile"; import { Search } from "@customTypes/Search"; import { API } from "@api/Api"; import styles from "./Sidebar.module.css"; import { FlagIcon, HomeIcon, PortalIcon, SearchIcon, } from "../../images/Images"; interface ContentProps { profile?: UserProfile; isSidebarOpen: boolean; sidebarButtonRefs: React.RefObject<(HTMLButtonElement | null)[]>; getButtonClasses: (buttonIndex: number) => string; handle_sidebar_click: (clicked_sidebar_idx: number) => void; }; const Content: React.FC = ({ profile, isSidebarOpen, sidebarButtonRefs, getButtonClasses, handle_sidebar_click }) => { const [searchData, setSearchData] = React.useState( undefined ); const searchbarRef = useRef(null); const _handle_search_change = async (q: string) => { const searchResponse = await API.get_search(q); setSearchData(searchResponse); }; const iconClasses = ""; return (
Search Search
_handle_search_change(e.target.value)} className="w-full p-2 bg-input text-foreground border border-border rounded-lg text-sm min-w-0" /> {searchData && (
{searchData?.maps.map((q, index) => ( {q.game} {q.chapter} {q.map} ))} {searchData?.players.map((q, index) => ( pfp {q.user_name} ))}
)}
); } export default Content;