-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support custom searchNoResultsText and searchSuggestedQueryText
- Loading branch information
1 parent
64adb23
commit 33aff8a
Showing
6 changed files
with
99 additions
and
3 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
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
10 changes: 8 additions & 2 deletions
10
packages/theme-default/src/components/Search/NoSearchResult.tsx
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 |
---|---|---|
@@ -1,14 +1,20 @@ | ||
import Empty from '@theme-assets/empty'; | ||
import { SvgWrapper } from '../SvgWrapper'; | ||
import { useLocaleSiteData } from '../../logic'; | ||
|
||
export function NoSearchResult({ query }: { query: string }) { | ||
const { | ||
searchNoResultsText = 'No results for', | ||
searchSuggestedQueryText = 'Please try again with a different keyword', | ||
} = useLocaleSiteData(); | ||
|
||
return ( | ||
<div className="flex flex-col items-center pt-8 pb-2"> | ||
<SvgWrapper icon={Empty} className="mb-4 opacity-80" /> | ||
<p className="mb-2"> | ||
No results for <b>"{query}"</b>. | ||
{searchNoResultsText} <b>"{query}"</b> | ||
</p> | ||
<p>Please try again with a different keyword.</p> | ||
<p>{searchSuggestedQueryText}</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