From 89fb07da0eb7ec1d8875747136f78d5f4b52a9f0 Mon Sep 17 00:00:00 2001 From: samlhuillier Date: Tue, 28 Nov 2023 21:32:59 -0600 Subject: [PATCH] fix search suggestions --- src/components/Search/Search.tsx | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/src/components/Search/Search.tsx b/src/components/Search/Search.tsx index 628bfce3..2f4cf620 100644 --- a/src/components/Search/Search.tsx +++ b/src/components/Search/Search.tsx @@ -49,7 +49,11 @@ const SearchComponent: React.FC = ({ onFileSelect }) => { }, []); return ( -
+
= ({ onFileSelect }) => { onChange={(e) => setSearchQuery(e.target.value)} placeholder="Search" /> -
- {searchResults.map((result, index) => ( -
onFileSelect(result.notepath)} - > -

{result.content}

-
- ))} -
+ {searchResults.length > 0 && ( +
+ {searchResults.map((result, index) => ( +
onFileSelect(result.notepath)} + > +

{result.content}

+
+ ))} +
+ )}
); };