From 3ba48e61924b661358716b2d9861031f7c308339 Mon Sep 17 00:00:00 2001 From: Kentai Radiquum Date: Wed, 20 Nov 2024 20:00:58 +0500 Subject: [PATCH] feat: add search box to the bookmarks catrgory page --- app/pages/BookmarksCategory.tsx | 49 +++++++++++++++++++++++++++++++++ app/pages/Search.tsx | 2 +- 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/app/pages/BookmarksCategory.tsx b/app/pages/BookmarksCategory.tsx index f882bef..e5948e6 100644 --- a/app/pages/BookmarksCategory.tsx +++ b/app/pages/BookmarksCategory.tsx @@ -36,6 +36,7 @@ export function BookmarksCategoryPage(props: any) { const authState = useUserStore((state) => state.state); const [selectedSort, setSelectedSort] = useState(0); const [isLoadingEnd, setIsLoadingEnd] = useState(false); + const [searchVal, setSearchVal] = useState(""); const router = useRouter(); const getKey = (pageIndex: number, previousPageData: any) => { @@ -93,6 +94,54 @@ export function BookmarksCategoryPage(props: any) { return ( <> +
{ + e.preventDefault(); + router.push(`/search?q=${searchVal}&where=list&list=${props.slug}`); + }} + > + +
+
+ +
+ setSearchVal(e.target.value)} + /> + +
+

{props.SectionTitleMapping[props.slug]} diff --git a/app/pages/Search.tsx b/app/pages/Search.tsx index 387bedb..8adf9be 100644 --- a/app/pages/Search.tsx +++ b/app/pages/Search.tsx @@ -189,7 +189,7 @@ export function SearchPage() { type="submit" className="text-white absolute end-2.5 bottom-2.5 bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-4 py-2 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800" > - Search + Поиск