From d254780ee98e7cee10655eaf39adf94936254d80 Mon Sep 17 00:00:00 2001 From: Owen Rees Date: Wed, 5 Jul 2023 21:56:30 +0200 Subject: [PATCH] remove clear button --- app/[lang]/tournois/SearchBar.tsx | 11 ++++------- app/[lang]/tournois/TournamentTable.tsx | 16 +--------------- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/app/[lang]/tournois/SearchBar.tsx b/app/[lang]/tournois/SearchBar.tsx index 249eb21..418e96f 100644 --- a/app/[lang]/tournois/SearchBar.tsx +++ b/app/[lang]/tournois/SearchBar.tsx @@ -1,13 +1,10 @@ -import { Dispatch, SetStateAction } from "react"; import { useTranslations } from "next-intl"; +import { useAtom } from "jotai/index"; +import { searchStringAtom } from "@/app/atoms"; -interface SearchBarProps { - searchString: string; - setSearchString: Dispatch>; -} - -const SearchBar = ({ searchString, setSearchString }: SearchBarProps) => { +const SearchBar = () => { const t = useTranslations("Tournaments"); + const [searchString, setSearchString] = useAtom(searchStringAtom); return (
diff --git a/app/[lang]/tournois/TournamentTable.tsx b/app/[lang]/tournois/TournamentTable.tsx index 044f79c..4f72e90 100644 --- a/app/[lang]/tournois/TournamentTable.tsx +++ b/app/[lang]/tournois/TournamentTable.tsx @@ -21,7 +21,6 @@ import ScrollToTopButton from "./ScrollToTopButton"; export default function TournamentTable() { const t = useTranslations("Tournaments"); - const [searchString, setSearchString] = useAtom(searchStringAtom); const filteredTournaments = useAtomValue(filteredTournamentsListAtom); const [syncVisible, setSyncVisible] = useAtom(syncVisibleAtom); const hoveredMapTournamentId = useAtomValue(hoveredMapTournamentIdAtom); @@ -41,10 +40,6 @@ export default function TournamentTable() { tournamentRow?.scrollIntoView({ behavior: "smooth" }); }, [debouncedHoveredMapTournamentId]); - const handleClearSearch = () => { - setSearchString(""); - }; - return (
- - +