Skip to content

Commit

Permalink
Add category to widgets in search
Browse files Browse the repository at this point in the history
  • Loading branch information
mitjapotocin committed Oct 21, 2023
1 parent 4795814 commit 3708530
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions components/Search/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,25 +147,27 @@ export default function Search() {
{searchResults.length > 0 && (
<Styled.StListWrapper>
<Command.List>
{searchResults.map(({ title, url, _type }) => {
{searchResults.map(({ title, url, category, _type }) => {
const path = getPath(url, _type);
const _title =
_type === "widget" ? `${category} - ${title}` : title;

return (
<Link
href={path}
onClick={() => {
setShowSearch(false);
}}
key={url}
key={_title}
>
<Command.Item
value={`${title} - ${searchResults.length}`}
value={`${_title} - ${searchResults.length}`}
onSelect={() => {
router.push(path);
setShowSearch(false);
}}
>
<div>{title}</div>
<div>{_title}</div>
<Styled.ItemType $type={_type}>{_type}</Styled.ItemType>
</Command.Item>
</Link>
Expand Down

1 comment on commit 3708530

@vercel
Copy link

@vercel vercel bot commented on 3708530 Oct 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

orange-web2 – ./

orange-web2-biolab.vercel.app
orange-web2-git-main-biolab.vercel.app
orange-web2.vercel.app

Please sign in to comment.