From 4a78eb13f67292c4d34197a45e4638f5f7554e5a Mon Sep 17 00:00:00 2001 From: Vivian Phung Date: Mon, 24 Jun 2024 18:54:32 -0400 Subject: [PATCH] fix: `ProjectSearchBarDialog` (search small screen) `Suggestions` once (#223) Refactor the rendering logic of the suggestion list in `ProjectSearchBarDialog` component. This change simplifies the conditional rendering by restructuring the JSX to be more readable and maintainable. Now, the 'Suggestions' label is rendered once if there are items, and the items are mapped afterward. --- --- .../ProjectSearchBarDialog.tsx | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/packages/frontend/src/components/projects/ProjectSearchBar/ProjectSearchBarDialog.tsx b/packages/frontend/src/components/projects/ProjectSearchBar/ProjectSearchBarDialog.tsx index 79a208e5..6f34c3af 100644 --- a/packages/frontend/src/components/projects/ProjectSearchBar/ProjectSearchBarDialog.tsx +++ b/packages/frontend/src/components/projects/ProjectSearchBar/ProjectSearchBarDialog.tsx @@ -100,22 +100,24 @@ export const ProjectSearchBarDialog = ({ }, )} > - {items.length > 0 - ? items.map((item, index) => ( - <> -
-

- Suggestions -

-
- - - )) - : inputValue && } + {items.length > 0 ? ( + <> +
+

+ Suggestions +

+
+ {items.map((item, index) => ( + + ))} + + ) : ( + inputValue && + )}