Skip to content

Commit

Permalink
fix: artist name
Browse files Browse the repository at this point in the history
  • Loading branch information
kyziq committed Jan 11, 2024
1 parent 2807468 commit 59e8ccd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
12 changes: 10 additions & 2 deletions src/components/Navbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,20 @@ const SearchAutocomplete = ({ allLists }) => {
}
};

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

const filterItems = (item, query) => {
const searchString = `${item.name} ${item.artistInfo.name}`.toLowerCase();
return searchString.includes(query.toLowerCase());
};

return (
<Autocomplete
defaultItems={allLists}
aria-label="Search for Artworks"
filterItems={filterItems}
classNames={{
base: 'max-w-lg',
listboxWrapper: 'max-h-[320px]',
Expand Down Expand Up @@ -85,7 +93,7 @@ const SearchAutocomplete = ({ allLists }) => {
<div className="flex flex-col">
<span className="text-small">{item.name}</span>
<span className="text-tiny text-default-400">
{item.artist}
{item.artistInfo.name}
</span>
</div>
</div>
Expand Down
4 changes: 3 additions & 1 deletion src/pages/ArtDescription.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ const ArtDescription = () => {
<h2 className="text-3xl font-bold text-gray-800">
{artItem.name}
</h2>
<p className="text-sm text-gray-600 mt-1">by {artItem.artist}</p>
<p className="text-sm text-gray-600 mt-1">
by {artItem.artistInfo.name}
</p>
</div>
</CardHeader>

Expand Down

0 comments on commit 59e8ccd

Please sign in to comment.