diff --git a/components/home/searches/searchesResults/BlockSearchResults.tsx b/components/home/searches/searchesResults/BlockSearchResults.tsx index b3b5348d49690abbacf9c0d79026b24de7355211..460d34f8e1f54b4e7be7b1b9174d015567693bc8 100644 --- a/components/home/searches/searchesResults/BlockSearchResults.tsx +++ b/components/home/searches/searchesResults/BlockSearchResults.tsx @@ -5,6 +5,7 @@ import useBlockSearch from "@/hooks/api/homePage/useBlockSearch"; import useOperationsTypes from "@/hooks/api/common/useOperationsTypes"; import ErrorPage from "@/pages/ErrorPage"; import { getBlockPageLink } from "../utils/blockSearchHelpers"; +import NoResults from "@/components/NoResults"; const BlockSearchResults = () => { const { blockSearchProps } = useSearchesContext(); @@ -22,26 +23,26 @@ const BlockSearchResults = () => { if (!blockSearchData) return; return ( - <div className="bg-theme dark:bg-theme p-2 md: h-fit rounded"> - <div className="text-center">Results:</div> - <div className="flex flex-wrap"> + <div className="bg-theme dark:bg-theme p-2 md:h-fit rounded"> + {blockSearchData.total_blocks > 0 ? ( - blockSearchData.blocks_result.map(({ block_num }) => ( - <Link - key={block_num} - href={blockPageLink(block_num)} - > - <div className="m-1 border border-solid p-1">{block_num}</div> - </Link> - )) + <> + <div className="text-center">Results:</div> + <div className="flex flex-wrap"> + {blockSearchData.blocks_result.map(({ block_num }) => ( + <Link key={block_num} href={blockPageLink(block_num)}> + <div className="m-1 border border-solid p-1">{block_num}</div> + </Link> + ))} + </div> + </> ) : ( - <div className="flex justify-center w-full"> - No blocks matching given criteria - </div> + <NoResults /> )} </div> - </div> + ); + }; export default BlockSearchResults;