fix: use blocks data for global search
This commit is contained in:
parent
8848282571
commit
428a66638f
|
@ -16,7 +16,7 @@ import { ReactNode, useEffect, useRef, useState } from 'react'
|
||||||
import { SearchLayout } from '@/layouts/SearchLayout'
|
import { SearchLayout } from '@/layouts/SearchLayout'
|
||||||
import { RelatedArticles } from '@/components/RelatedArticles'
|
import { RelatedArticles } from '@/components/RelatedArticles'
|
||||||
import { RelatedContent } from '@/components/RelatedContent'
|
import { RelatedContent } from '@/components/RelatedContent'
|
||||||
import { useSearchBarContext } from '@/context/searchbar.context'
|
import { Section } from '@/components/Section/Section'
|
||||||
|
|
||||||
interface SearchPageProps {
|
interface SearchPageProps {
|
||||||
articles: SearchResultItem<UnbodyGoogleDoc>[]
|
articles: SearchResultItem<UnbodyGoogleDoc>[]
|
||||||
|
@ -72,10 +72,16 @@ export default function SearchPage({
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{articles.data?.length && <RelatedArticles articles={articles.data} />}
|
{articles.data?.length ? (
|
||||||
|
<RelatedArticles articles={articles.data} />
|
||||||
{/* TODO: used initialBlocks instead of blocks.data temporarily to render data */}
|
) : (
|
||||||
{initialBlocks?.length && <RelatedContent blocks={initialBlocks} />}
|
<Section title={'No Related Articles'} />
|
||||||
|
)}
|
||||||
|
{blocks.data?.length ? (
|
||||||
|
<RelatedContent blocks={blocks.data} />
|
||||||
|
) : (
|
||||||
|
<Section title={'No Related Content'} />
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue