Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions src/components/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,20 @@ export const HitComponent = ({ hit, onClick }: HitProps) => {
const path = `/${hit.slug}/`;

return (
<div className="mb-4" onClick={onClick}>
<Link
to={path}
className="block text-xl font-medium text-light-blue-900 tracking-tight mb-0 mt-0 no-underline"
>
<Highlight attribute="title" hit={hit} highlightedTagName="mark" /> - {hit.category}
</Link>
<Link
to={path}
className="block no-underline focus:outline-none focus:bg-light-blue-25 text-light-blue-900 p-2"
onClick={onClick}
>
<div className="text-xl font-medium tracking-tight mb-0 mt-0">
<Highlight attribute="title" hit={hit} highlightedTagName="mark" />
{Boolean(hit.category) ? `- ${hit.category}` : ''}
</div>

<Link to={path} className="no-underline">
<p className="!m-0">
<Snippet attribute="excerpt" hit={hit} highlightedTagName="mark" />
</Link>
</div>
</p>
</Link>
);
};

Expand Down Expand Up @@ -55,7 +57,10 @@ export default function Search(props: SearchProps) {
</svg>
)}
/>
<Hits hitComponent={({ hit }) => <HitComponent hit={hit} onClick={props.onHide} />} />
<Hits
classNames={{ item: 'm-0' }}
hitComponent={({ hit }) => <HitComponent hit={hit} onClick={props.onHide} />}
/>
</InstantSearch>
);
}
Loading