Skip to content

Commit

Permalink
feat: add searchable by artist name
Browse files Browse the repository at this point in the history
  • Loading branch information
kyziq committed Jan 11, 2024
1 parent 6466ab3 commit 3553d83
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/components/Navbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ const SearchAutocomplete = ({ allLists }) => {
navigate(`/art/${id}`);
}
};

const itemToString = (item) => (item ? `${item.name} - ${item.artist}` : '');

return (
<Autocomplete
defaultItems={allLists}
Expand Down Expand Up @@ -66,11 +69,11 @@ const SearchAutocomplete = ({ allLists }) => {
startContent={<FaSearch size={18} />}
radius="full"
variant="bordered"
onSelectionChange={(key) => handleSelectionChange(key)}
itemToString={(item) => item?.name}
onSelectionChange={handleSelectionChange}
itemToString={itemToString}
>
{(item) => (
<AutocompleteItem key={item.id} textValue={item.name}>
<AutocompleteItem key={item.id} textValue={itemToString(item)}>
<div className="flex justify-between items-center">
<div className="flex gap-2 items-center">
<Avatar
Expand Down

0 comments on commit 3553d83

Please sign in to comment.