-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add not found state * Fix hydration errors
- Loading branch information
Showing
5 changed files
with
122 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
'use client'; | ||
|
||
export const NotFoundIcon = ({ className }: { className?: string }) => ( | ||
<svg | ||
className={className} | ||
width="126" | ||
height="127" | ||
viewBox="0 0 126 127" | ||
fill="none" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<circle cx="73.241" cy="73.9562" r="52.3836" fill="#EEEAFF" /> | ||
<path | ||
fillRule="evenodd" | ||
clipRule="evenodd" | ||
d="M17.2087 46.2917C17.2087 30.0223 30.3976 16.8333 46.667 16.8333C62.9364 16.8333 76.1253 30.0223 76.1253 46.2917C76.1253 62.5611 62.9364 75.75 46.667 75.75C30.3976 75.75 17.2087 62.5611 17.2087 46.2917ZM46.667 8.41667C25.7492 8.41667 8.79199 25.3739 8.79199 46.2917C8.79199 67.2095 25.7492 84.1667 46.667 84.1667C55.6098 84.1667 63.8287 81.0673 70.3082 75.8842L85.7747 91.3507C87.4182 92.9942 90.0827 92.9942 91.7262 91.3507C93.3697 89.7073 93.3697 87.0427 91.7262 85.3993L76.2596 69.9327C81.4427 63.4533 84.542 55.2344 84.542 46.2917C84.542 25.3739 67.5848 8.41667 46.667 8.41667Z" | ||
fill="url(#paint0_linear_256_2115)" | ||
/> | ||
<defs> | ||
<linearGradient | ||
id="paint0_linear_256_2115" | ||
x1="-11.012" | ||
y1="-27.6548" | ||
x2="42.9044" | ||
y2="-52.4877" | ||
gradientUnits="userSpaceOnUse" | ||
> | ||
<stop stopColor="#715DE1" /> | ||
<stop offset="1" stopColor="#CF65E0" /> | ||
</linearGradient> | ||
</defs> | ||
</svg> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
'use client'; | ||
|
||
import { useHits, useLoading, useQuery } from '@clinia/search-sdk-react'; | ||
import { cn } from '@clinia-ui/react'; | ||
import { NotFoundIcon } from './not-found-icon'; | ||
|
||
type NotFoundProps = { | ||
className?: string; | ||
}; | ||
export const NotFound = ({ className }: NotFoundProps) => { | ||
const [query] = useQuery(); | ||
const hits = useHits(); | ||
const loading = useLoading(); | ||
|
||
if (hits?.length > 0 || loading) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<div | ||
className={cn( | ||
'flex max-w-[790px] flex-col items-center gap-2 text-center', | ||
className | ||
)} | ||
> | ||
<NotFoundIcon /> | ||
<h2 className="text-xl font-medium text-foreground"> | ||
No results found for '{query}' | ||
</h2> | ||
<p> | ||
There aren't any results matching your query. This can happen when | ||
you search for something overly specific, or something outside the scope | ||
of your dataset. | ||
</p> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters