Skip to content

Commit

Permalink
remove filter for h1 in search results
Browse files Browse the repository at this point in the history
  • Loading branch information
bdbch committed Jun 27, 2024
1 parent 786f4e5 commit 9eca07e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/long-dogs-call.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'tiptap-docs': patch
---

Include h1's in search results
8 changes: 4 additions & 4 deletions src/components/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { useAppState } from '@/providers/AppState'

const SearchResult = ({ hit, active }: { hit: SearchHit; active?: boolean }) => {
const { result, parents } = useMemo(() => {
const hierarchy = Object.entries(hit.hierarchy).filter((h) => !!h[1])
const hierarchy = Object.entries(hit.hierarchy)
const result = hierarchy.at(-1)
const parents = hierarchy.slice(0, -1)

Expand Down Expand Up @@ -41,11 +41,11 @@ const SearchResult = ({ hit, active }: { hit: SearchHit; active?: boolean }) =>
<span className="flex items-center gap-0.5 flex-wrap mt-1 font-medium">
{parents.map(([key, value], i) => (
<>
<span className="text-xs text-grayAlpha-500 block" key={key}>
<span className="block text-xs text-grayAlpha-500" key={key}>
{value}
</span>
{i < parents.length - 1 ? (
<span className="text-xs text-grayAlpha-400 block">/</span>
<span className="block text-xs text-grayAlpha-400">/</span>
) : null}
</>
))}
Expand Down Expand Up @@ -117,7 +117,7 @@ const SearchContent = () => {
))
: null}
{query && hits.hits.length === 0 ? (
<div className="flex justify-center items-center p-2 mt-2">
<div className="flex items-center justify-center p-2 mt-2">
<span className="text-grayAlpha-400">
No results found for <strong>{query}</strong>
</span>
Expand Down

0 comments on commit 9eca07e

Please sign in to comment.