From a91ebf1353432d8dced29049b26df5eea7ee39d9 Mon Sep 17 00:00:00 2001
From: MohamedBassem <me@mbassem.com>
Date: Wed, 13 Mar 2024 05:21:29 +0000
Subject: mobile: Bump version to 1.1.0

---
 packages/mobile/app/dashboard/(tabs)/search.tsx | 33 +++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 packages/mobile/app/dashboard/(tabs)/search.tsx

(limited to 'packages/mobile/app/dashboard/(tabs)/search.tsx')

diff --git a/packages/mobile/app/dashboard/(tabs)/search.tsx b/packages/mobile/app/dashboard/(tabs)/search.tsx
new file mode 100644
index 00000000..0cc16716
--- /dev/null
+++ b/packages/mobile/app/dashboard/(tabs)/search.tsx
@@ -0,0 +1,33 @@
+import { keepPreviousData } from "@tanstack/react-query";
+import { useState } from "react";
+import { View } from "react-native";
+import { useDebounce } from "use-debounce";
+
+import BookmarkList from "@/components/bookmarks/BookmarkList";
+import { Input } from "@/components/ui/Input";
+import { api } from "@/lib/trpc";
+
+export default function Search() {
+  const [search, setSearch] = useState("");
+
+  const [query] = useDebounce(search, 200);
+
+  const { data } = api.bookmarks.searchBookmarks.useQuery(
+    { text: query },
+    { placeholderData: keepPreviousData },
+  );
+
+  return (
+    <View className="flex gap-2 p-2">
+      <Input
+        placeholder="Search"
+        className="bg-white"
+        value={search}
+        onChangeText={setSearch}
+        autoFocus
+        autoCapitalize="none"
+      />
+      {data && <BookmarkList ids={data.bookmarks.map((b) => b.id)} />}
+    </View>
+  );
+}
-- 
cgit v1.2.3-70-g09d2

