mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 07:33:07 +08:00
Merge branch 'feat-search' into deployment
This commit is contained in:
@@ -36,7 +36,8 @@ export default function SearchBar({ searchList }: Props) {
|
|||||||
const fuse = new Fuse(searchList, {
|
const fuse = new Fuse(searchList, {
|
||||||
keys: ["title", "description"],
|
keys: ["title", "description"],
|
||||||
includeMatches: true,
|
includeMatches: true,
|
||||||
threshold: 0.3,
|
minMatchCharLength: 2,
|
||||||
|
threshold: 0.5,
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -66,7 +67,7 @@ export default function SearchBar({ searchList }: Props) {
|
|||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
{searchResults && searchResults.length > 0 && (
|
{inputVal.length > 1 && (
|
||||||
<div className="mt-8">
|
<div className="mt-8">
|
||||||
Found {searchResults?.length}
|
Found {searchResults?.length}
|
||||||
{searchResults?.length && searchResults?.length > 1
|
{searchResults?.length && searchResults?.length > 1
|
||||||
|
|||||||
Reference in New Issue
Block a user