From 246eabe4a46d2585d653738e46089ed2bfada8bd Mon Sep 17 00:00:00 2001 From: Wolfboy248 Date: Mon, 25 Aug 2025 09:36:51 +0200 Subject: Restructured sidebar and implemented links var --- frontend/src/components/Sidebar/Search.tsx | 66 ++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 frontend/src/components/Sidebar/Search.tsx (limited to 'frontend/src/components/Sidebar/Search.tsx') diff --git a/frontend/src/components/Sidebar/Search.tsx b/frontend/src/components/Sidebar/Search.tsx new file mode 100644 index 0000000..0c6b868 --- /dev/null +++ b/frontend/src/components/Sidebar/Search.tsx @@ -0,0 +1,66 @@ +import React, { useRef } 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; + isSearching: boolean; +}; + +const _Search: React.FC = ({ profile, isSearching }) => { + 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); + }; + 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; -- cgit v1.2.3