mirror of
https://github.com/snowball-tools/snowballtools-base.git
synced 2024-12-22 12:37:42 +00:00
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. ---
This commit is contained in:
parent
41bcb2e7d0
commit
4a78eb13f6
@ -100,22 +100,24 @@ export const ProjectSearchBarDialog = ({
|
|||||||
},
|
},
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{items.length > 0
|
{items.length > 0 ? (
|
||||||
? items.map((item, index) => (
|
|
||||||
<>
|
<>
|
||||||
<div className="px-2 py-2">
|
<div className="px-2 py-2">
|
||||||
<p className="text-elements-mid-em text-xs font-medium">
|
<p className="text-elements-mid-em text-xs font-medium">
|
||||||
Suggestions
|
Suggestions
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
{items.map((item, index) => (
|
||||||
<ProjectSearchBarItem
|
<ProjectSearchBarItem
|
||||||
key={item.id}
|
key={item.id}
|
||||||
item={item}
|
item={item}
|
||||||
{...getItemProps({ item, index })}
|
{...getItemProps({ item, index })}
|
||||||
/>
|
/>
|
||||||
|
))}
|
||||||
</>
|
</>
|
||||||
))
|
) : (
|
||||||
: inputValue && <ProjectSearchBarEmpty />}
|
inputValue && <ProjectSearchBarEmpty />
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Dialog.Content>
|
</Dialog.Content>
|
||||||
|
Loading…
Reference in New Issue
Block a user